On 15/12/2013 22:46, Igor Korot wrote:
Tim,
On Sun, Dec 15, 2013 at 4:29 AM, Tim Chase
<python.l...@tim.thechases.com> wrote:
On 2013-12-15 06:17, Tim Chase wrote:
conn = sqlite3.connect('x.sqlite',
... detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
Your example code omitted this one crucial line. Do you specify the
detect_types parameter to connect()?
Yes, I did.
This is the beginning of the session:
import sqlite3
conn = sqlite3.connect('c:\Documents and
Settings\Igor.FORDANWORK\Desktop\mydb.db', detect_types =
sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
When writing paths on Windows, it's a good idea to use raw string
literals or slashes instead of backslashes:
conn = sqlite3.connect(r'c:\Documents and
Settings\Igor.FORDANWORK\Desktop\mydb.db', detect_types =
sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
or:
conn = sqlite3.connect('c:/Documents and
Settings/Igor.FORDANWORK/Desktop/mydb.db', detect_types =
sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
Also please note that you session was missing the cursor creation command. ;-)
Thank you.
It's really the PARSE_DECLTYPES that is important.
http://docs.python.org/2/library/sqlite3.html#sqlite3.PARSE_DECLTYPES
--
https://mail.python.org/mailman/listinfo/python-list