Version 2.6 released

90 views
Skip to first unread message

Pierre Quentel

unread,
Sep 11, 2011, 4:05:41 AM9/11/11
to PyDbLite
Hi,

I just released version 2.6

Change log :

PyDbLite.py (pure-Python)
- attribute path is the path of the database in the file system (was
called "name" in previous versions)
- attribute name is the base name of the database, without the
extension
- if db exists, read field names on instance creation
- allow add_field on an instance even if it was not open()
- adapt code to run on Python2 and Python3

MySQL.py
- Connection is a dictionary of Databases
- Database is a dictionary of Tables
- access by record id works if table has a PRIMARY KEY (not just
AUTO_INCREMENT)
- add parameter charset in Connection creation
- use execute_many if a list is passed to insert
- more complete error messages
- supports 2 different implementations of MySQLdb to specify the
charset used in a connection
- fix bug if empty list is passed to insert()

SQLite.py
- remove class Connection, make class Database a dictionary with keys
= table names
- allow insertion of a list of records and in this case, use
executemany
- adapt SQLite to run on Python2 and Python3

All tests now use the unittest module

Best regards
Pierre

Jim Eggleston

unread,
Sep 26, 2011, 9:49:35 AM9/26/11
to PyDbLite
Hi Pierre,

I found a bug in SQLite.py. At line 409 in the __call__ method, you
need to change:

self.cursor.execute(sql,kw.values())

to:

self.cursor.execute(sql,list(kw.values()))

I did a search across all .py files in the package. I found three
instances of "self.execute(sql,kw.values())" in MySQL.py, so you
should check that as well.

Regards,
Jim

Pierre Quentel

unread,
Sep 26, 2011, 3:02:01 PM9/26/11
to PyDbLite


On 26 sep, 15:49, Jim Eggleston <jim.eggles...@gmail.com> wrote:
> Hi Pierre,
Hi Jim,
>
> I found a bug in SQLite.py. At line 409 in the __call__ method, you
> need to change:
>
>         self.cursor.execute(sql,kw.values())
>
> to:
>
>         self.cursor.execute(sql,list(kw.values()))
>
I was working with the SQLite module today and found a bug in the same
area, when you don't pass any argument to __call__ (ie when you want
to get all the records). I will fix this one too
> I did a search across all .py files in the package. I found three
> instances of "self.execute(sql,kw.values())" in MySQL.py, so you
> should check that as well.
For the MySQL file it's not really a problem, since there is no
Python3 version of MySQLdb as far as I know
>
> Regards,
> Jim
Best,
Pierre

Toon's

unread,
Oct 17, 2011, 5:25:14 PM10/17/11
to PyDbLite
Hi Pierre,

It seems there is a problem in __init__.py.

when I use PyDbLite with python3
8<---
import PyDbLite
[...]
base = PyDbLite.Base(...)
[...]
--->8
I got an error saying PyDbLite does not have Base attribute.

So I replaced the first line in __init__.py
from PyDbLite import *
by
from .PyDbLite import * # relative package import using dot
And my script runs fine under both python3 and python2

Regards
Toon's
Reply all
Reply to author
Forward
0 new messages