[sqlalchemy] add foreign key constraint

2013-11-14 Thread jonas geiregat
I have a table called session which has foreign key constraints. I removed them and auto generated a migration script. The upgrade function is populated as expected but the downgrade function isn't. I searched through the available operations but can't find what i need. The create_foreign_key

Re: [sqlalchemy] add foreign key constraint

2013-11-14 Thread Simon King
On Thu, Nov 14, 2013 at 8:47 AM, jonas geiregat geiregatjo...@gmail.com wrote: I have a table called session which has foreign key constraints. I removed them and auto generated a migration script. The upgrade function is populated as expected but the downgrade function isn't. I searched

Re: [sqlalchemy] pre-populated instances

2013-11-14 Thread Richard Gerd Kuesters
Thanks Mike. I was hoping someone would say that :D I was just thinking if there were something that would be used with CI in mind - I think I did not made it clear before. But with my old payload, I can still add controls to perform those tasks :) Kind regards, Richard. On 11/13/2013

[sqlalchemy] Re: Debugging 'StatementError: Can't reconnect until invalid transaction is rolled back' error

2013-11-14 Thread Phil
To solve this problem, you should open a new db session at the beginning of the web request, and close the session at the end of the request. See the pattern here: http://docs.sqlalchemy.org/en/latest/orm/session.html#using-thread-local-scope-with-web-applications On Monday, October 31, 2011

Re: [sqlalchemy] Invalid query formed: table listed twice in FROM

2013-11-14 Thread Michael Bayer
On Nov 14, 2013, at 10:18 AM, Michael Woods mikeswo...@gmail.com wrote: Hi SA community This issue has been bugging me for a while. Hopefully someone has some input, since this issue is really impeding my work at this point. Using the following code query_object =

Re: [sqlalchemy] add foreign key constraint

2013-11-14 Thread jonas geiregat
If I use create_foreign_key then I end up with sequence tables in my database... def upgrade(): op.drop_constraint('session_server_fkey', 'session', 'foreignkey') op.drop_constraint('session_app_fkey', 'session', 'foreignkey') def downgrade(): op.create_foreign_key(

Re: [sqlalchemy] Mixing ORM and set-returning-functions (e.g. generate_series)

2013-11-14 Thread Daniel Grace
On Wednesday, November 13, 2013 4:48:47 PM UTC-8, Michael Bayer wrote: [...] see attached for demo, should get you started Thanks! That was a tremendous help. I've attached the version I ended up working with, using your code as a base. The main changes, besides some names, are: -

Re: [sqlalchemy] Mixing ORM and set-returning-functions (e.g. generate_series)

2013-11-14 Thread Daniel Grace
Gmail warns you before posting something with I've attached and no attachment, but apparently Google Groups does not. -- 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

[sqlalchemy] Reflecting a mapped object

2013-11-14 Thread Brendan Condon
I am using sqlalchemy 0.9 and flask / flask-sqlalchemy. I want to pass in the name of a table and an id and get back the object. I use reflection to get the table object, but can't seem to a way to get from the table object to the mapped object. I feel like I am missing something basic, but

Re: [sqlalchemy] Reflecting a mapped object

2013-11-14 Thread Michael Bayer
if you’re looking for an anonymous class that’s generated on the fly, you can take a look at sqlsoup: https://sqlsoup.readthedocs.org/en/latest/ On Nov 14, 2013, at 5:56 PM, Brendan Condon bren...@brendancondon.com wrote: I am using sqlalchemy 0.9 and flask / flask-sqlalchemy. I want to