[Tutor] please help with sqlite replace function

aivars aivars868 at gmail.com
Fri Nov 7 06:02:16 CET 2008


John, just to add to my previous post.

after copying sqlite3.dll (3.6.2) version into Python25\DLLs directory
and running

import sqlite3
dir(sqlite3)

>>> sqlite3.version
'2.3.2'

>>> sqlite3.version_info
(2, 3, 2)

>>> sqlite3.sqlite_version_info
(3, 6, 2)

>>> sqlite3.sqlite_version
'3.6.2'

and now my scrip happily runs with sqlite replace function.

I am just curious why there are so many different version properties
and why now they differ from sqlite3.version?
Of course it seems Python now is running sqlite version 3.6.2 since my
script accepts replace function

Thanks,
Aivars



2008/11/7 aivars <aivars868 at gmail.com>:
> Thanks, John,
> Yes it seems you are right. The ActiveState python version I have
> installed have sqlite 2.3.2 only. I find it strange.
> I see that on a python website there is is a new version Python26
> relesed. Should i go on and install Python26? I understand that I can
> install pure Python from python website and after that I can install
> Mark Hammonds PythonWin to get other things for windows? Or maybe I
> will reinstall ActiveState Python25 and install Python25 from the
> official website
>
> Copying dll to c:\python25\DLLs directory did not help - it still
> shows version sqlite version 2.3.2. which I also do not understand why
>
> Re user defined function - it is one of the ways to go probably
> quickest but I would like to have newer version of sqlite being
> already with python
>
> I am noob in Python still
>
> Thanks for your input
>
> Aivars
>
>
>
> 2008/11/6 John Fouhy <john at fouhy.net>:
>> 2008/11/7 aivars <aivars868 at gmail.com>:
>>> I use python 2.5.2.2 (activestate), WinXP, sqlite version 3.6.2
>>
>> Hi Aivars,
>>
>> I believe python has its own built-in sqlite, rather than using the
>> version you installed independently.  So it is possible that the
>> python version of sqlite is older than 3.6.2 and does not yet have the
>> replace() function.
>>
>> (run 'import sqlite3' and then examine 'sqlite3.sqlite_version' to see
>> what version you are using)
>>
>> You could try replacing sqlite3.dll in your python25\dlls directory
>> with the DLL from your sqlite installation (make a backup first :-) ).
>>  Alternatively, you could define the replace() function in python and
>> then add it to your database: see
>> http://www.initd.org/pub/software/pysqlite/doc/usage-guide.html#creating-user-defined-functions
>> .
>>
>> HTH.
>>
>> --
>> John.
>>
>


More information about the Tutor mailing list