Re: Drop followed by generation of Foreign Keys

2015-09-23 Thread Mike Bayer
On 9/22/15 7:38 PM, Sergi Pons Freixes wrote: 2015-09-22 16:24 GMT-07:00 Mike Bayer >: Revision runs fine, but now when I run the upgrade it does not find the alembic_version table (attached logs)... I suspect that the

[sqlalchemy] how to dynamically work with an aliased table?

2015-09-23 Thread Jonathan Vanasco
I have a query where I derive an object based on some dynamic filters on a relationship: sql_ors = [ sqlalchemy.func.lower(Bar.string_id) == id_search.lower(), sqlalchemy.func.lower(Bar.numeric_id) == id_search.lower(), ] query = dbSession.query(Foo)\

[sqlalchemy] Re: How to get specific attribute from last row?

2015-09-23 Thread Jonathan Vanasco
You should share your SqlAlchemy model along with an executable script that illustrates the query and others can comment-on or fix. You are simply showing a mixture of raw data and random results that are without any context. -- You received this message because you are subscribed to the

[sqlalchemy] Re: How to get specific attribute from last row?

2015-09-23 Thread Sebastian M Cheung
posts = User.query.all() row = posts.select().execute().fetchone() print row[-1] return row.activation_code doesnt work -- 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

[sqlalchemy] Re: How to get specific attribute from last row?

2015-09-23 Thread Sebastian M Cheung
for v in posts: for column, value in v.items(): print '{0}: {1}'.format(column, value) Also doesn't work -- 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

[sqlalchemy] How to get specific attribute from last row?

2015-09-23 Thread Sebastian M Cheung
This is my example, how to get the activation_code from my row? Thanks [ { "activation_code": "840896", "id": 1, "mobile": "447533345452" }, { "activation_code": "947721", "id": 2, "mobile": "447533345452" }, { "activation_code": "335548", "id": 3,

[sqlalchemy] Error on update data

2015-09-23 Thread Hana Iku
Hi! I'm trying save or update a register in database after check if it's exists or not, the save part it's ok, but the update always show the same error: "FlushError: New instance with identity key (, (u'1',)) conflicts with persistent instance " I read about this here