Re: [sqlalchemy] Insert from JSON data (coping with unneeded fields and varying types)
See also: ColanderAlchemy https://colanderalchemy.readthedocs.org/en/latest/index.html On Thu, Dec 19, 2013 at 8:23 AM, Paul Moore wrote: > On Tuesday, 17 December 2013 20:43:33 UTC, Michael Bayer wrote: > >> typically you should write marshaling code here using a schema library - >> though I’ve not used it, I’d recommend colander for this: >> http://docs.pylonsproject.org/projects/colander/en/latest/ >> > > Nice, thanks! I hadn't heard of colander, and didn't know the term "schema > library" so wouldn't have got very far with Google. I'll take a look at > this. > > Paul > > -- > 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/groups/opt_out. > -- -- Kevin Horn -- 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/groups/opt_out.
Re: [sqlalchemy] Database locker error with sqlite in multi-process environment
On 12/19/2013 01:39 PM, Michael Bayer wrote: SQLite doesn’t work great for concurrent access. Or is the database file just stuck in a locked state? try copying it to a different file. On Dec 19, 2013, at 12:51 AM, AM wrote: PS: The only thing I can think of that is not quite usual is that I have a save method on my models and that calls flush() on the session object. and the session is created using: DB = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) Thanks. AM On 12/18/2013 09:35 PM, AM wrote: Hi All. I have a pyramid app, that uses sqlite via sqlalchemy when run in development. The configuration used: sqlalchemy.url = sqlite:///%(here)s/pyp.sqlite?pool_size=1 sqlalchemy.isolation_level = SERIALIZABLE The application initializes the engine using: settings = config.get_settings() engine = sa.engine_from_config(settings, 'sqlalchemy.') DB.configure(bind=engine) BASE.metadata.bind = engine Another part of the application that runs as a daemon also uses the same setup. This daemon always starts after the app. The daemon initializes the engine using the same piece of code. When the application tries to insert a record in the database I get the following error: OperationalError: (OperationalError) database is locked I am fairly certain I had this working previously quite some time back but for the life of me cannot remember how. Any help would be greatly appreciated. Thanks. AM -- 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/groups/opt_out. I have tried copying and moving the file around, yet still run into this. Oh well I guess its time to get postgres up and running. Thanks. AM -- 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/groups/opt_out.
Re: [sqlalchemy] Database locker error with sqlite in multi-process environment
SQLite doesn’t work great for concurrent access. Or is the database file just stuck in a locked state? try copying it to a different file. On Dec 19, 2013, at 12:51 AM, AM wrote: > PS: > > The only thing I can think of that is not quite usual is that I have a save > method on my models and that calls flush() on the session object. > > and the session is created using: > > DB = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) > > > Thanks. > AM > > > On 12/18/2013 09:35 PM, AM wrote: >> Hi All. >> >> I have a pyramid app, that uses sqlite via sqlalchemy when run in >> development. >> >> The configuration used: >> >> sqlalchemy.url = sqlite:///%(here)s/pyp.sqlite?pool_size=1 >> sqlalchemy.isolation_level = SERIALIZABLE >> >> The application initializes the engine using: >> >> settings = config.get_settings() >> engine = sa.engine_from_config(settings, 'sqlalchemy.') >> DB.configure(bind=engine) >> BASE.metadata.bind = engine >> >> >> Another part of the application that runs as a daemon also uses the same >> setup. This daemon always starts after the app. The daemon initializes >> the engine using the same piece of code. >> >> When the application tries to insert a record in the database I get the >> following error: >> >> OperationalError: (OperationalError) database is locked >> >> I am fairly certain I had this working previously quite some time back >> but for the life of me cannot remember how. >> >> Any help would be greatly appreciated. >> >> Thanks. >> AM > > -- > 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/groups/opt_out. signature.asc Description: Message signed with OpenPGP using GPGMail
Re: [sqlalchemy] Insert from JSON data (coping with unneeded fields and varying types)
On Tuesday, 17 December 2013 20:43:33 UTC, Michael Bayer wrote: > typically you should write marshaling code here using a schema library - > though I’ve not used it, I’d recommend colander for this: > http://docs.pylonsproject.org/projects/colander/en/latest/ > Nice, thanks! I hadn't heard of colander, and didn't know the term "schema library" so wouldn't have got very far with Google. I'll take a look at this. Paul -- 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/groups/opt_out.