[sqlalchemy] eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
Here's my issue: 3 tables CREATE TABLE accounts ( account_id serial PRIMARY KEY, name varchar(16) NOT NULL UNIQUE, ); CREATE TABLE transactions ( transaction_id serial PRIMARY KEY, ); CREATE TABLE entries ( entry_id serial PRIMARY KEY, account_id integer NOT NULL REFERENCES

[sqlalchemy] eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
Here's my issue: 3 tables CREATE TABLE accounts ( account_id serial PRIMARY KEY, name varchar(16) NOT NULL UNIQUE, ); CREATE TABLE transactions ( transaction_id serial PRIMARY KEY, ); CREATE TABLE entries ( entry_id serial PRIMARY KEY, account_id integer NOT NULL REFERENCES

[sqlalchemy] Many-to-Many, Column not available

2007-09-11 Thread KyleJ
I get the same result with this in 0.3.10 and 0.4beta5 Basic idea: I have two tables which hold various data and a third table which let's different rows in each table be related to another (many-to-many relationship). Table/ORM code: base_table = Table('base_type', metadata,

[sqlalchemy] Re: How to safely increasing a numeric value via SQLAlchemy

2007-09-11 Thread Hermann Himmelbauer
Am Dienstag, 11. September 2007 10:54 schrieb svilen: in 0.4 there is atomic update, e.g. update set a=expression syntax is something like table.update( values=dict-of-name-expression ).execute( **bindings-if-any) expressions is whatever sa sql expression Ah, that's interesting. Is it

[sqlalchemy] Re: How to safely increasing a numeric value via SQLAlchemy

2007-09-11 Thread svilen
On Tuesday 11 September 2007 13:35:18 Hermann Himmelbauer wrote: Am Dienstag, 11. September 2007 10:54 schrieb svilen: in 0.4 there is atomic update, e.g. update set a=expression syntax is something like table.update( values=dict-of-name-expression ).execute( **bindings-if-any)

[sqlalchemy] Re: Many-to-Many, Column not available

2007-09-11 Thread svilen
wild guess: do u need relations_table.id? rename/remove it On Tuesday 11 September 2007 12:34:47 KyleJ wrote: I get the same result with this in 0.3.10 and 0.4beta5 Basic idea: I have two tables which hold various data and a third table which let's different rows in each table be related

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-09-11 Thread stephen emslie
I've done some more playing here and I think I can see why the multiple contains_eager options dont work on a self-referential mapping. Here's my example again: ali = trees.alias() ali2 = trees.alias() statement = trees.outerjoin(ali, and_(trees.c.node_id==ali.c.parent_node_id,

[sqlalchemy] ((( EXCELLENT CONSULTANTS FOR YOUR REKS )))

2007-09-11 Thread Chandra Shekar
*Dear Partner,* * * *Hope you are doing great.* * * *We have excellent consultants on the skill sets of: **C++ Developer, Sr.Business Analyst, IBM Main Frames, Java/J2ee, QA / QA Lead,** **SAP BW, SAS, SQL Server Developer, Siebel, Sr.ETL / Informatica / Data Warehousing**,. Please go through

[sqlalchemy] Re: How to safely increasing a numeric value via SQLAlchemy

2007-09-11 Thread Michael Bayer
On Sep 11, 2007, at 2:25 AM, Hermann Himmelbauer wrote: Hi, I need to safely increase a numeric value via SQLAlchemy: I have a table that has a column with numeric data. For increasing the value, I need to read the data, add some value and store it, so it would look like that: -

[sqlalchemy] Re: eagerload_all issue

2007-09-11 Thread Michael Bayer
On Sep 11, 2007, at 10:28 AM, Jean-Philippe Dutreve wrote: The name is on account, not on entry. Transactions and all must be loaded in one shot starting from a single account: account (e.g. id=7) == all its entries === one Transaction for each entry == all entries of each

[sqlalchemy] Re: eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
Ive uploaded the script eagerload_all.py that reproduce the issue. Hope it helps you. On 11 sep, 16:43, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 11, 2007, at 10:28 AM, Jean-Philippe Dutreve wrote: The name is on account, not on entry. Transactions and all must be loaded in one shot

[sqlalchemy] Re: eagerload_all issue

2007-09-11 Thread Jean-Philippe Dutreve
its actually not eager loading the second list of accounts If there is no eager loading on the second list, I don't understand why a 'SELECT entries ...' is executed when I just ask account.name and not account.entries. untested, i.e. join_depth on a mapper thats not self-referential,

[sqlalchemy] ((( OUR CONSULTANTS AVAILABLE FOR YOUR REKS )))

2007-09-11 Thread Chandra Shekar
*Dear Partner,* * * *Hope you are doing great.* * * *We have excellent consultants on the skill sets of: **C++ Developer, Sr.Project Leader/Sr.Software Specialist , SAP FICO FUNCTIONAL(Certified), Sr.Business Analyst, IBM Main Frames, QA ,** **SAP BW, SAS, SQL Server Developer, Siebel, Sr.ETL

[sqlalchemy] How to get ID back from database after save?

2007-09-11 Thread Lukasz Szybalski
Hello, I am saving to my column in this way. How do I get the primary key id back from database? z=User() z.LASTNAME='smith' z.FIRSTNAME='joe' z.save_or_update() z.flush() How do I get my z.USER_SID which is my primary auto increment key in database. Lucas

[sqlalchemy] Weak Referencing Session

2007-09-11 Thread Michael Bayer
Hello - Over here at SQLAlchemy labs, we have a new branch available against 0.4 which I am considering merging (well, most of it will probably be merged regardless for architectural cleanup purposes, but theres one particular feature in question). The primary behavioral change is that the

[sqlalchemy] Re: Weak Referencing Session

2007-09-11 Thread Mike Bernson
Is there any chance of making it an option to not have a weak reference ? How about something on the session level with sessionmaker ? Having it the session level would help me but not sure if make sense there. I have things in the model object that depend on the object not going away. I have

[sqlalchemy] Re: How to get ID back from database after save?

2007-09-11 Thread Rick Morrison
You should find it at z.USER_SID after the flush. Not sure about your save() and flush() calls howevershould be session.save_or_update(z) and session.flush() On 9/11/07, Lukasz Szybalski [EMAIL PROTECTED] wrote: Hello, I am saving to my column in this way. How do I get the primary key

[sqlalchemy] Re: db autogenerated pks?

2007-09-11 Thread KyleJ
You probably need to override the autoloaded primary key column: http://www.sqlalchemy.org/docs/04/metadata.html#metadata_tables_reflecting_overriding Specify the type with MSUniqueIdentifier from sqlalchemy.databases.mssql On Sep 11, 9:01 am, Smoke [EMAIL PROTECTED] wrote: Hi All, I'm new

[sqlalchemy] Re: Many-to-Many, Column not available

2007-09-11 Thread KyleJ
Oh, and yes I did try (without any change) specifying uselist=True for the BaseType mapper. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: sqlalchemy with turbogears and assign_mapper: group_by

2007-09-11 Thread Lukasz Szybalski
On 9/10/07, Roger Demetrescu [EMAIL PROTECTED] wrote: On 9/8/07, Lukasz Szybalski [EMAIL PROTECTED] wrote: On 9/7/07, Paul Johnston [EMAIL PROTECTED] wrote: Hi, And if I wanted to select a year and group by year? select User.Year from User group by User.Year

[sqlalchemy] Re: sqlalchemy with turbogears and assign_mapper: group_by

2007-09-11 Thread Lukasz Szybalski
Hi, And if I wanted to select a year and group by year? select User.Year from User group by User.Year db.execute(select([User.Year]) ??? Have a look at http://www.sqlalchemy.org/docs/04/sqlexpression.html Ok. Based on documentation. I do: import

[sqlalchemy] Re: sqlalchemy with turbogears and assign_mapper: group_by

2007-09-11 Thread Lukasz Szybalski
On 9/11/07, Lukasz Szybalski [EMAIL PROTECTED] wrote: Hi, And if I wanted to select a year and group by year? select User.Year from User group by User.Year db.execute(select([User.Year]) ??? Have a look at

[sqlalchemy] getattr(myresults,ColumName) vs myresults[ColumnName]

2007-09-11 Thread Lukasz Szybalski
Hello, Are there any plans to make the attributes of selected results more dictionary like? Currently when you get a record via sqlalachemy You have an option of Getting and setting attributes by getattr and setattr. myresults.c.keys() then to get the values you have to: for column in