using converters, adapters in sqlite3

M

matthewperpick

hello,

i want to make use of sqlite3's "adapter" and "converter" capabilities
but my classes are more complex than the point examples in the python
documentation (http://docs.python.org/lib/node347.html), because they
include foreign keys to othe rtables.

I don't want to concatenate those with the class' other data in one
column because then I lose the ability to filter data by FK in my
select queries.

so .. I was hoping someone could show me how to write converters &
adapters that will allow me to each attribute in its own column.

Thanks very much,

Matt
 
D

Dennis Lee Bieber

i want to make use of sqlite3's "adapter" and "converter" capabilities
but my classes are more complex than the point examples in the python
documentation (http://docs.python.org/lib/node347.html), because they
include foreign keys to othe rtables.
said:
so .. I was hoping someone could show me how to write converters &
adapters that will allow me to each attribute in its own column.
Somehow I don't think you'll be able to do it that way. The
converter/adapter interface is designed to assume the object is a
self-contained "unit"; when the object is encountered in a parameterized
query it is to be converted to a single string in a format that can be
decoded later, and stored in a single column of the table -- your
requirements indicate it is not a unit, but multiple related entities;
you might be better off adding methods to the classes to do
insert/update/select for instances.

Possibly one of the ORM packages compatible with SQLite could be
stuffed in between your objects and the database to handle the
conversion.
Thanks very much,

Matt
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top