[sqlalchemy] Seamlessly combining data from multiple tables into a single SQLalchemy object

2015-02-10 Thread Dun Peal
I have a declarative base called Foo, instances of which get most of their attributes from a Foo SQL table. However, Foo also has a bar_id attribute, which is a foreign key linking to the primary key of a Bar table. Bar is really just an extension of Foo, with a few extra attributes that belong

[sqlalchemy] Re: Seamlessly combining data from multiple tables into a single SQLalchemy object

2015-02-10 Thread Jonathan Vanasco
That's what the association proxy does: http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/associationproxy.html On Tuesday, February 10, 2015 at 8:47:29 PM UTC-5, Dun Peal wrote: I have a declarative base called Foo, instances of which get most of their attributes from a Foo SQL

Re: [sqlalchemy] sql custom function

2015-02-10 Thread jo
Hi Glauco, I'm glad to hear you. :-) Yes, you were right, I really forgot to register the function. I'll see you around. j Glauco wrote: Il 10/02/2015 09:33, jo ha scritto: Hi all, I can't realize how to create a sql custom function. I need to transform a string column value into a number

Re: [sqlalchemy] sql custom function

2015-02-10 Thread Glauco
Il 10/02/2015 09:33, jo ha scritto: Hi all, I can't realize how to create a sql custom function. I need to transform a string column value into a number as in: def mese(par): mm = dict(A=1,B=2,C=3,D=4,E=5,H=6,L=7,M=8,P=9,R=10,S=11,T=12) return mm[par.upper()] I tried to use

Re: [sqlalchemy] Why is assignment of a transient parent object does not automatically add this parent object into the session?

2015-02-10 Thread Bao Niu
I guess what I must do immediately is to get myself a pair of new glasses...Thank you Simon! On Tue, Feb 10, 2015 at 2:36 PM, Simon King si...@simonking.org.uk wrote: On 10 Feb 2015, at 22:14, Bao Niu niuba...@gmail.com wrote: Why is assignment of a transient parent object does not

[sqlalchemy] Why is assignment of a transient parent object does not automatically add this parent object into the session?

2015-02-10 Thread Bao Niu
Why is assignment of a transient parent object does not automatically add this parent object into the session? But Parent.append(PersistedChild) will do the job nicely? Here is my code: from sqlalchemy import Column, String, Integer, ForeignKey from sqlalchemy import create_engine from

Re: [sqlalchemy] Why is assignment of a transient parent object does not automatically add this parent object into the session?

2015-02-10 Thread Simon King
On 10 Feb 2015, at 22:14, Bao Niu niuba...@gmail.com wrote: Why is assignment of a transient parent object does not automatically add this parent object into the session? But Parent.append(PersistedChild) will do the job nicely? Here is my code: from sqlalchemy import Column, String,

[sqlalchemy] engine.execute() appears to do nothing when using the compilation extension. Bug, or am I missing a step?

2015-02-10 Thread Mike Richards
When attempting to create a SQL Server view the method located on StackOverflow http://stackoverflow.com/questions/9766940/how-to-create-an-sql-view-with-sqlalchemy does not work. Am I missing something? I've tried enabling autocommit in _execution_options to no avail. Beyond that I'm unsure what

Re: [sqlalchemy] engine.execute() appears to do nothing when using the compilation extension. Bug, or am I missing a step?

2015-02-10 Thread Michael Bayer
Mike Richards justanotherb...@gmail.com wrote: When attempting to create a SQL Server view the method located on StackOverflow does not work. Am I missing something? I've tried enabling autocommit in _execution_options to no avail. Beyond that I'm unsure what to try next. Thank you