[sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative
Hi, I've written a class decorator to define a boilerplate __init__ on some of my models that inherit from a declarative_base superclass. The problem is that sqlalchemy.orm.instrumentation._generate_init() has already installed an __init__ and when I overwrite that, things break with object has no attribute '_sa_instance_state' exceptions. I've provided a sample below. It actually throws a different exception than my code but I think the root issue is the same, that is, my __init__ replaced the generated one and so the ClassManager events are not being emitted. Is there some blessed way to add an __init__ method after a class is already defined or is that just impossible with sqlalchemy's metaprogramming environment? Love the library. Very powerful and excellent documentation. Thanks. Eric $ python Python 2.7.10 (default, May 26 2015, 04:16:29) [GCC 5.1.0] on linux2 Type help, copyright, credits or license for more information. import psycopg2 import sqlalchemy psycopg2.__version__ '2.6 (dt dec pq3 ext lo64)' conn = psycopg2.connect(dbname=dispatch_dev) cur = conn.cursor() cur.execute(SELECT version();) cur.fetchone() ('PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 5.1.0, 64-bit',) sqlalchemy.__version__ '0.9.7' from collections import OrderedDict from decimal import Decimal from sqlalchemy import Column, Integer, Numeric from sqlalchemy.ext.declarative import declarative_base def licensed(licenses): ... def decorate(cls): ... def ___init__(self, **kwargs): ... for k, v in self.licenses.items(): ... kwargs.setdefault('{}_license_rate'.format(k), v) ... super(cls, self).__init__(**kwargs) ... cls.__init__ = ___init__ ... for k, v in licenses.items(): ... licenses[k] = Decimal(v) ... cls.licenses = licenses ... for license in licenses: ... setattr(cls, '{}_license_rate'.format(license), Column( Numeric, nullable=False)) ... return cls ... return decorate ... Base = declarative_base() @licensed(OrderedDict((('foo', 100), ('bar', 150 ... class Instance_Link(Base): ... __tablename__ = 'instance_link' ... id = Column(Integer, primary_key=True) ... Instance_Link(foo_license_rate=50) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 6, in ___init__ File (...)/env/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py, line 526, in _declarative_constructor setattr(self, k, kwargs[k]) File (...)/env/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py, line 225, in __set__ self.impl.set(instance_state(instance), AttributeError: 'NoneType' object has no attribute 'set' -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Does twophase=True limit to only two databases at the same time?
Oh by the way, I'm using SQLite as backend. On Aug 14, 2015 2:04 AM, Jinghui Niu niujing...@gmail.com wrote: I have three different DBs, one is person.db, another is journal.db, yet another is tag.db. In the documentation it reads: Vertical partitioning places different kinds of objects, or different tables, across multiple databases: engine1 = create_engine('postgresql://db1') engine2 = create_engine('postgresql://db2') Session = sessionmaker(twophase=True) # bind User operations to engine 1, Account operations to engine 2 Session.configure(binds={User:engine1, Account:engine2}) session = Session() I noticed that this example only deals with two DBs, and the parameter is called twophase. I was wondering if there is any significance of two here? How can I fit my third DB in? Thanks. -- You received this message because you are subscribed to a topic in the Google Groups sqlalchemy group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/tRlV984I_64/unsubscribe. To unsubscribe from this group and all its topics, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Does twophase=True limit to only two databases at the same time?
I have three different DBs, one is person.db, another is journal.db, yet another is tag.db. In the documentation it reads: Vertical partitioning places different kinds of objects, or different tables, across multiple databases: engine1 = create_engine('postgresql://db1') engine2 = create_engine('postgresql://db2') Session = sessionmaker(twophase=True) # bind User operations to engine 1, Account operations to engine 2 Session.configure(binds={User:engine1, Account:engine2}) session = Session() I noticed that this example only deals with two DBs, and the parameter is called twophase. I was wondering if there is any significance of two here? How can I fit my third DB in? Thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Does twophase=True limit to only two databases at the same time?
On 8/14/15 5:07 AM, Jinghui Niu wrote: Oh by the way, I'm using SQLite as backend. On Aug 14, 2015 2:04 AM, Jinghui Niu niujing...@gmail.com mailto:niujing...@gmail.com wrote: I have three different DBs, one is person.db, another is journal.db, yet another is tag.db. In the documentation it reads: Vertical partitioning places different kinds of objects, or different tables, across multiple databases: engine1 = create_engine('postgresql://db1') engine2 = create_engine('postgresql://db2') Session = sessionmaker(twophase=True) # bind User operations to engine 1, Account operations to engine 2 Session.configure(binds={User:engine1, Account:engine2}) session = Session() I noticed that this example only deals with two DBs, and the parameter is called twophase. I was wondering if there is any significance of two here? How can I fit my third DB in? Thanks. twophase refers to enabling two-phase commit on supporting backends, which does not include SQLite. See https://en.wikipedia.org/wiki/Two-phase_commit_protocol. -- You received this message because you are subscribed to a topic in the Google Groups sqlalchemy group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/tRlV984I_64/unsubscribe. To unsubscribe from this group and all its topics, send an email to sqlalchemy+unsubscr...@googlegroups.com mailto:sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com mailto:sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Does twophase=True limit to only two databases at the same time?
twophase deals with the transaction commit protocol , and is unlreated to anything else in your example. (http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.params.twophase) You'd simply create an engine3 and bind whatever object classes to it. FWIW. Sqlite does not support two-phase commits. Fore more info on two-phase commits - https://en.wikipedia.org/wiki/Two-phase_commit_protocol -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative
this code is incorrect from a Python perspective. You're removing the original `__init__` method entirely and it is never called; the attempt to call it using super() just calls object.__init__. SQLAlchemy is already decorating the __init__ method of the mapped class so you can't just throw it away, you can decorate it but you need to make sure its still called. Here is a plain demonstration without any SQLAlchemy: def licensed(): def decorate(cls): def ___init__(self, **kwargs): print magic new init! super(cls, self).__init__(**kwargs) cls.__init__ = ___init__ return cls return decorate @licensed() class SomeClass(object): def __init__(self): print normal init! SomeClass() Only magic new init! is printed. SomeClass.__init__ is never called. Here's the correct way to decorate a function in this context: def licensed(licenses): def decorate(cls): orig_init = cls.__init__ def ___init__(self, **kwargs): for k, v in self.licenses.items(): kwargs.setdefault('{}_license_rate'.format(k), v) orig_init(self, **kwargs) cls.__init__ = ___init__ On 8/14/15 2:41 AM, Eric Atkin wrote: Hi, I've written a class decorator to define a boilerplate __init__ on some of my models that inherit from a declarative_base superclass. The problem is that sqlalchemy.orm.instrumentation._generate_init() has already installed an __init__ and when I overwrite that, things break with object has no attribute '_sa_instance_state' exceptions. I've provided a sample below. It actually throws a different exception than my code but I think the root issue is the same, that is, my __init__ replaced the generated one and so the ClassManager events are not being emitted. Is there some blessed way to add an __init__ method after a class is already defined or is that just impossible with sqlalchemy's metaprogramming environment? Love the library. Very powerful and excellent documentation. Thanks. Eric | $ python Python2.7.10(default,May262015,04:16:29) [GCC 5.1.0]on linux2 Typehelp,copyright,creditsorlicenseformore information. importpsycopg2 importsqlalchemy psycopg2.__version__ '2.6 (dt dec pq3 ext lo64)' conn =psycopg2.connect(dbname=dispatch_dev) cur =conn.cursor() cur.execute(SELECT version();) cur.fetchone() ('PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 5.1.0, 64-bit',) sqlalchemy.__version__ '0.9.7' fromcollections importOrderedDict fromdecimalimportDecimal fromsqlalchemy importColumn,Integer,Numeric fromsqlalchemy.ext.declarative importdeclarative_base deflicensed(licenses): ...defdecorate(cls): ...def___init__(self,**kwargs): ...fork,v inself.licenses.items(): ...kwargs.setdefault('{}_license_rate'.format(k),v) ...super(cls,self).__init__(**kwargs) ...cls.__init__ =___init__ ...fork,v inlicenses.items(): ...licenses[k]=Decimal(v) ...cls.licenses =licenses ...forlicense inlicenses: ... setattr(cls,'{}_license_rate'.format(license),Column(Numeric,nullable=False)) ...returncls ...returndecorate ... Base=declarative_base() @licensed(OrderedDict((('foo',100),('bar',150 ...classInstance_Link(Base): ...__tablename__ ='instance_link' ...id =Column(Integer,primary_key=True) ... Instance_Link(foo_license_rate=50) Traceback(most recent call last): Filestdin,line 1,inmodule Filestdin,line 6,in___init__ File(...)/env/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py,line 526,in_declarative_constructor setattr(self,k,kwargs[k]) File(...)/env/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py,line 225,in__set__ self.impl.set(instance_state(instance), AttributeError:'NoneType'objecthas noattribute 'set' | -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com mailto:sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative
This works. Thank you for the quick response and great libraries (I use Mako as well). Eric On Fri, Aug 14, 2015 at 9:07 AM, Mike Bayer mike...@zzzcomputing.com wrote: this code is incorrect from a Python perspective. You're removing the original `__init__` method entirely and it is never called; the attempt to call it using super() just calls object.__init__.SQLAlchemy is already decorating the __init__ method of the mapped class so you can't just throw it away, you can decorate it but you need to make sure its still called. Here is a plain demonstration without any SQLAlchemy: def licensed(): def decorate(cls): def ___init__(self, **kwargs): print magic new init! super(cls, self).__init__(**kwargs) cls.__init__ = ___init__ return cls return decorate @licensed() class SomeClass(object): def __init__(self): print normal init! SomeClass() Only magic new init! is printed. SomeClass.__init__ is never called. Here's the correct way to decorate a function in this context: def licensed(licenses): def decorate(cls): orig_init = cls.__init__ def ___init__(self, **kwargs): for k, v in self.licenses.items(): kwargs.setdefault('{}_license_rate'.format(k), v) orig_init(self, **kwargs) cls.__init__ = ___init__ On 8/14/15 2:41 AM, Eric Atkin wrote: Hi, I've written a class decorator to define a boilerplate __init__ on some of my models that inherit from a declarative_base superclass. The problem is that sqlalchemy.orm.instrumentation._generate_init() has already installed an __init__ and when I overwrite that, things break with object has no attribute '_sa_instance_state' exceptions. I've provided a sample below. It actually throws a different exception than my code but I think the root issue is the same, that is, my __init__ replaced the generated one and so the ClassManager events are not being emitted. Is there some blessed way to add an __init__ method after a class is already defined or is that just impossible with sqlalchemy's metaprogramming environment? Love the library. Very powerful and excellent documentation. Thanks. Eric $ python Python 2.7.10 (default, May 26 2015, 04:16:29) [GCC 5.1.0] on linux2 Type help, copyright, credits or license for more information. import psycopg2 import sqlalchemy psycopg2.__version__ '2.6 (dt dec pq3 ext lo64)' conn = psycopg2.connect(dbname=dispatch_dev) cur = conn.cursor() cur.execute(SELECT version();) cur.fetchone() ('PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 5.1.0, 64-bit',) sqlalchemy.__version__ '0.9.7' from collections import OrderedDict from decimal import Decimal from sqlalchemy import Column, Integer, Numeric from sqlalchemy.ext.declarative import declarative_base def licensed(licenses): ... def decorate(cls): ... def ___init__(self, **kwargs): ... for k, v in self.licenses.items(): ... kwargs.setdefault('{}_license_rate'.format(k), v) ... super(cls, self).__init__(**kwargs) ... cls.__init__ = ___init__ ... for k, v in licenses.items(): ... licenses[k] = Decimal(v) ... cls.licenses = licenses ... for license in licenses: ... setattr(cls, '{}_license_rate'.format(license), Column( Numeric, nullable=False)) ... return cls ... return decorate ... Base = declarative_base() @licensed(OrderedDict((('foo', 100), ('bar', 150 ... class Instance_Link(Base): ... __tablename__ = 'instance_link' ... id = Column(Integer, primary_key=True) ... Instance_Link(foo_license_rate=50) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 6, in ___init__ File (...)/env/lib/python2.7/site-packages/sqlalchemy/ext/declarative/base.py , line 526, in _declarative_constructor setattr(self, k, kwargs[k]) File (...)/env/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py, line 225, in __set__ self.impl.set(instance_state(instance), AttributeError: 'NoneType' object has no attribute 'set' -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to a topic in the Google Groups sqlalchemy group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/u_WdnuCSvCU/unsubscribe. To unsubscribe from this group and all its topics, send an email to
[sqlalchemy] Re: Does twophase=True limit to only two databases at the same time?
Thanks for all these helpful feedback. If I still want to use SQLite, and I still need to do vertical partition, what can I do? Am I out of luck? On Friday, August 14, 2015 at 2:04:37 AM UTC-7, Jinghui Niu wrote: I have three different DBs, one is person.db, another is journal.db, yet another is tag.db. In the documentation it reads: Vertical partitioning places different kinds of objects, or different tables, across multiple databases: engine1 = create_engine('postgresql://db1') engine2 = create_engine('postgresql://db2') Session = sessionmaker(twophase=True) # bind User operations to engine 1, Account operations to engine 2 Session.configure(binds={User:engine1, Account:engine2}) session = Session() I noticed that this example only deals with two DBs, and the parameter is called twophase. I was wondering if there is any significance of two here? How can I fit my third DB in? Thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Does twophase=True limit to only two databases at the same time?
Thank you very much Jonathan for your very intuitive analogy! Basically I just want to put people, journal and tag tables(each will potentially be very large) into different DBs, if I write that logic, how can I integrate it with SQLAlchemy? Could you give me a rough idea here? Or point some reference. I suppose such feature is relatively commonly needed among SQLite users isn't it? On Friday, August 14, 2015 at 3:48:40 PM UTC-7, Jonathan Vanasco wrote: On Friday, August 14, 2015 at 5:16:48 PM UTC-4, Jinghui Niu wrote: If I still want to use SQLite, and I still need to do vertical partition, what can I do? Am I out of luck? You can, but not with a two-phase commit. Two-phase commit basically works like this: - round 1, everyone locks-state and votes COMMIT! or N! - round 2, if commit in round 1 was unanimous, it commits. otherwise everyone is told to roll back. Since SQLlite doesn't support that, you'd need to write that logic in at the application level. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Does twophase=True limit to only two databases at the same time?
On Friday, August 14, 2015 at 5:16:48 PM UTC-4, Jinghui Niu wrote: If I still want to use SQLite, and I still need to do vertical partition, what can I do? Am I out of luck? You can, but not with a two-phase commit. Two-phase commit basically works like this: - round 1, everyone locks-state and votes COMMIT! or N! - round 2, if commit in round 1 was unanimous, it commits. otherwise everyone is told to roll back. Since SQLlite doesn't support that, you'd need to write that logic in at the application level. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Does twophase=True limit to only two databases at the same time?
Thanks Jonathan for pointing out the direction, it is very helpful to know where I can find more info. On Friday, August 14, 2015 at 5:06:09 PM UTC-7, Jonathan Vanasco wrote: Well, this problem doesn't really have anything to do with SqlAlchemy -- you should probably ask people for advice on the Sqlite lists or Stack Overflow. You can segment out your database into 3 files using the example above. You will just run into an issue where -- because there isn't a two-phase-commit available in Sqlite, you will need to decide how to handle situations like (but not limited to): - the first and second databases committed, but the third database raised an error (you need to undo in the application) - the first and second databases committed, but your application was quit before the third database could commit (you need to undo from another application) You will have to decide how to handle that at the application and database levels, and then SqlAlchemy can be used to implement that strategy. I just want to be clear -- your concern right now is on the best way to use Sqlite to solve your problem -- not use Sqlalchemy. Once you figure that out, people here can be more helpful. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Does twophase=True limit to only two databases at the same time?
Well, this problem doesn't really have anything to do with SqlAlchemy -- you should probably ask people for advice on the Sqlite lists or Stack Overflow. You can segment out your database into 3 files using the example above. You will just run into an issue where -- because there isn't a two-phase-commit available in Sqlite, you will need to decide how to handle situations like (but not limited to): - the first and second databases committed, but the third database raised an error (you need to undo in the application) - the first and second databases committed, but your application was quit before the third database could commit (you need to undo from another application) You will have to decide how to handle that at the application and database levels, and then SqlAlchemy can be used to implement that strategy. I just want to be clear -- your concern right now is on the best way to use Sqlite to solve your problem -- not use Sqlalchemy. Once you figure that out, people here can be more helpful. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Re: Does twophase=True limit to only two databases at the same time?
Just a thought, if I don't commit those three tables together in my application, can I just use 3 Session objects to commit them separately, without having to worry about this two phase issue? I want to go simple, not sure if I can handle this fancy stuff:) On Friday, August 14, 2015 at 5:20:07 PM UTC-7, Jinghui Niu wrote: Thanks Jonathan for pointing out the direction, it is very helpful to know where I can find more info. On Friday, August 14, 2015 at 5:06:09 PM UTC-7, Jonathan Vanasco wrote: Well, this problem doesn't really have anything to do with SqlAlchemy -- you should probably ask people for advice on the Sqlite lists or Stack Overflow. You can segment out your database into 3 files using the example above. You will just run into an issue where -- because there isn't a two-phase-commit available in Sqlite, you will need to decide how to handle situations like (but not limited to): - the first and second databases committed, but the third database raised an error (you need to undo in the application) - the first and second databases committed, but your application was quit before the third database could commit (you need to undo from another application) You will have to decide how to handle that at the application and database levels, and then SqlAlchemy can be used to implement that strategy. I just want to be clear -- your concern right now is on the best way to use Sqlite to solve your problem -- not use Sqlalchemy. Once you figure that out, people here can be more helpful. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.