[Tutor] please help with sqlite replace function
aivars
aivars868 at gmail.com
Thu Nov 6 22:05:32 CET 2008
Hello,
I am stuck now.
I have a sqlite database with a table calendar (which is an auxilary
calendar table containing dates, years, months, days)
>From sqlite prompt I can run the following query without any problem:
SELECT replace( datums,'-','' ) FROM calendar where Y='2008' and M='5'
It gives me back date strings in the format YYYYMMDD.
But when I run it from the python script it gives me the following error:
sqlite3.OperationalError: no such function: replace.
Script is simple as follows:
import sqlite3
spath=r'e:\pythonexamples\aivars2.db'
sql="SELECT replace(datums,'-','') FROM Calendar where Y='2008' and M='5'"
cn=sqlite3.connect(spath)
for row in cn.execute(sql):
print row[0]
When I run the script without the replace function in select statement
it runs OK.
I use python 2.5.2.2 (activestate), WinXP, sqlite version 3.6.2
Thanks for any tip.
maybe I should ask this to sqlite mailing list?
Aivars
More information about the Tutor
mailing list