[sqlalchemy] Re: Conditional Insert Rewrite (part 2)

2015-01-19 Thread Lycovian
TL;DR: I'm trying to rewrite a query to remove the column 'x' in the following query which is an numeric type column at execution time: or how to turn this: INSERT into 't' (id, x) VALUES (?, ?), (1, None) = INSERT into t (id) values (?), (1,) I have been able to remove the offending bind

Re: [sqlalchemy] Postgresql multi scheme recreate mapper ?

2015-01-19 Thread Michael Bayer
this won’t help you right now but there’s an eventual plan to add more functionality in this area, I’ve just enhanced this ticket to include a “mapping” feature that would work in your case: https://bitbucket.org/zzzeek/sqlalchemy/issue/2685/default-schema-schema-translation-map-as Michael

Re: [sqlalchemy] session.execute() list of params with nullable fields

2015-01-19 Thread Michael Bayer
the first entry in the list of parameters determines how the INSERT statement will be written. if you have different sets of keys in each parameter set, then you should invoke session.execute() individually for each set of parameters. Pavel Aborilov abori...@gmail.com wrote: Hi! I have

Re: [sqlalchemy] session.execute() list of params with nullable fields

2015-01-19 Thread Pavel Aborilov
I understood, but it's not obvious, for me. Is it mentioned in the docs? On Monday, January 19, 2015 at 4:47:18 PM UTC+3, Michael Bayer wrote: the first entry in the list of parameters determines how the INSERT statement will be written. if you have different sets of keys in each

Re: [sqlalchemy] SQL join between two tables from two databases

2015-01-19 Thread Jonathan Vanasco
I haven't seen anyone bring this up before. If you get stuck and no better answer shows up here... I'd try just having a single session with tables from both DBs in it, and using raw SQL to populate the ORM objects -- using the MySQL native cross-database query format. It's not elegant, but I

[sqlalchemy] Firebird SQL 'rdb$get_context eq' equivalent in PostGreSQL

2015-01-19 Thread Werner
Hi, I like to move to eventually support PGSQL 9.3+ as an alternative engine. With Firebird SQL I am using the following to set/get the language used by a connection/user. rdb$get_context('USER_SESSION', 'LANGUAGE_ID') - http://www.firebirdsql.org/refdocs/langrefupd20-get-context.html

Re: [sqlalchemy] session.execute() list of params with nullable fields

2015-01-19 Thread Michael Bayer
yes: http://docs.sqlalchemy.org/en/rel_0_9/core/tutorial.html#executing-multiple-statements When executing multiple sets of parameters, each dictionary must have the same set of keys; i.e. you cant have fewer keys in some dictionaries than others. This is because the Insert statement is

Re: [sqlalchemy] Postgresql multi scheme recreate mapper ?

2015-01-19 Thread Michael Bayer
M3nt0r3 m3nt...@gmail.com wrote: Here, in the log i change the search_path to veterfarma that is the news scheme but the query is performed to ferchim. that is the first schema i choose on the app start. i have __table__ = Table('foo', metadata, schema=schema,

Re: [sqlalchemy] Postgresql multi scheme recreate mapper ?

2015-01-19 Thread M3nt0r3
I tried this solution in many ways but without success. 2015-01-19 16:34:45,599 INFO sqlalchemy.engine.base.Engine {} 2015-01-19 16:34:45,599 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 2015-01-19 16:34:45,599 INFO sqlalchemy.engine.base.Engine

[sqlalchemy] session.execute() list of params with nullable fields

2015-01-19 Thread Pavel Aborilov
Hi! I have model with nullable fields and try to add bulk of items: insert = model.__table__.insert() session.execute(insert, events) where events in the list of dicts with params and if first element in list don't have that nullable params, then event if other elements have one, they won't be

Re: [sqlalchemy] session.execute() list of params with nullable fields

2015-01-19 Thread Pavel Aborilov
Oh, sorry, didn't find that. пн, 19 янв. 2015, 19:06, Michael Bayer mike...@zzzcomputing.com: yes: http://docs.sqlalchemy.org/en/rel_0_9/core/tutorial.html# executing-multiple-statements When executing multiple sets of parameters, each dictionary must have the same set of keys; i.e. you

Re: [sqlalchemy] Postgresql multi scheme recreate mapper ?

2015-01-19 Thread M3nt0r3
Thanks, i am trying to follow your answer but i want to respond to your question. i have one main schema ( like a public one ) whith general tables and in others schemas are almost identicals, there is , sometimes a difference in the number of tables ( some big module is active ) but tables

Re: [sqlalchemy] Postgresql multi scheme recreate mapper ?

2015-01-19 Thread Michael Bayer
M3nt0r3 m3nt...@gmail.com wrote: Thanks, i am trying to follow your answer but i want to respond to your question. i have one main schema ( like a public one ) whith general tables and in others schemas are almost identicals, there is , sometimes a difference in the number of tables (