Re: [PDO-Users]help needed: pysqlite troubles

pythondbo-users-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Wed, 15 Jun 2005 09:50:00 -0400
Newsgroups gmane.comp.python.db.pdo.user
Message-ID <[email protected]>
Hello!

We're looking into this - it looks like updates to the pysqlite2 may 
have broken compatibility with pdo.  We're setting up a test environ on 
our end.  More soon!

~Jon Franz
NeuroKode Labs, LLC

pythondbo-users-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org wrote:
> Hello!
> 
> PDO seemed to be exactly what I need in order to connect to an sqlite3
> database from within Python code; however I cannot get this to work.
> 
> I can use pysqlite (v. 2.0.3) with code like this:
> 
> ----cut here------------------------------------------------
> from pysqlite2 import dbapi2 as sqlite
> connection = sqlite.connect("trial.db", isolation_level=None)
> cursor = connection.cursor()
> # -- create a table:
> cursor.execute('BEGIN')
> stmt = """CREATE TABLE Family (
>             id        int     not NULL,
>             name      text    not NULL,
>             age       int     not NULL, -- format: YYYYMMDD
>             uid       numeric not NULL,
>             comm      text    NULL
> );"""
> cursor.execute(stmt)
> # -- populate the table:
> stmt = 'insert into Family values(?,?,?,?,NULL)'
> for i in range(0,99999):
>     cursor.execute(stmt, (i, 'Name-'+`i`, i+2, '681022'+`i`))
> # -- that's it!
> cursor.execute('COMMIT')
> ----cut here------------------------------------------------
> 
> The above code works. But when I try to open a db connection using pdo,
> I inevitably fail:
> 
>  >>> conn = pdo.connect('Module=pysqlite2;DB=trial.db')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "D:\devtools\python\python241\lib\site-packages\pdo.py", line 80, 
> in __init__
>     raise pdo_connection_error, self.ErrorMessage
> pdo.pdo_connection_error: "Unable to load Database Module: Database 
> specific
> Error:exceptions.AttributeError\n'module' object has no attribute 
> 'paramstyle'"
> 
> I tried some variations but all seemed to be false. What am I doing wrong?
> 
> Any help would be more than appreciated -- thanks!
> Yassen
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Pythondbo-users mailing list
> Pythondbo-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/pythondbo-users


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click