[sqlalchemy] Re: how to join tables properly

2008-09-29 Thread Alex K
Hello, Ksenia, This may help: http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_relation_strategies_containseager On Sep 29, 2:38 am, Ksenia [EMAIL PROTECTED] wrote: Hi list, I can't figure out a very simple thing. All I want is to do this query: select table1.A, table2.B,

[sqlalchemy] Force Load all attributes during a Query

2008-09-29 Thread Harish K Vishwanath
Hello, Is there a way to tell the session to force load all the attributes of an object during a query? (i,e even if it is already present in the Identity Map?). For some reason, auto_expire_on_commit, if set to True is not working well with my app. I always do a session.query(object) before

[sqlalchemy] Setting up a many-to-many relation with no right-hand-side table

2008-09-29 Thread Nick Murdoch
Hi everyone, I have an unusual situation where I have a set of users that are stored in an SQL DB as usual, and a set of news articles that are stored elsewhere (not in an SQL database). Usually, if both sets were stored in two DB tables, I'd be able to set up a many-to-many relationship with

[sqlalchemy] Re: Setting up a many-to-many relation with no right-hand-side table

2008-09-29 Thread Alex K
Not sure about append, but you can definitely use column_property for generated select property, more details here: http://www.sqlalchemy.org/docs/05/mappers.html#advdatamapping_mapper_expressions Alex On 29 сент, 16:03, Nick Murdoch [EMAIL PROTECTED] wrote: Hi everyone, I have an unusual

[sqlalchemy] Dynamic mapping strategy

2008-09-29 Thread Alex K
Hi All, My application uses XML schema to load tables, classes, set SQLA mapping and relations. Each processing node (thread or process, depends on config) does not know beforehand what type of mapping it will process, that's why I need to create mapping (parse schema, and generate classes) per

[sqlalchemy] Best way to populate with data?

2008-09-29 Thread Arthur Pemberton
What is the best way to populate an app with data, for base data and test data purposes? Is there an easy way to maintain some XML files with the base and tests data? or is it the best way to just have a python script with the data hard coded into it? -- Fedora 9 : sulphur is good for the skin

[sqlalchemy] Re: Setting up a many-to-many relation with no right-hand-side table

2008-09-29 Thread Michael Bayer
On Sep 29, 2008, at 8:03 AM, Nick Murdoch wrote: What I need to do instead, with no Articles table, is store in user_articles_table the user_id and article_id as I would usually, but also have user.articles available as a list of integers (or some wrapper that provided the integers).

[sqlalchemy] Re: Dynamic mapping strategy

2008-09-29 Thread Michael Bayer
On Sep 29, 2008, at 9:30 AM, Alex K wrote: Hi All, My application uses XML schema to load tables, classes, set SQLA mapping and relations. Each processing node (thread or process, depends on config) does not know beforehand what type of mapping it will process, that's why I need to

[sqlalchemy] Uppercase column names in table.insert({ })

2008-09-29 Thread Itamar Ravid
Hey guys - I've ran into a strange bug in 0.4.7p1 while trying to make use of Elixir's versioned plugin. In Oracle, given a table created as such: CREATE TABLE books (book_id NUMBER PRIMARY KEY); The following code fails: dbEng = create_engine(oracle://:@pearl) meta = MetaData() meta.bind =

[sqlalchemy] Re: Dynamic mapping strategy

2008-09-29 Thread Alex K
Thanks for such a detailed response! I'll try schema caching approach and will bring back the results, Thanks again, Alex On 29 сент, 18:21, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 29, 2008, at 9:30 AM, Alex K wrote: Hi All, My application uses XML schema to load tables,

[sqlalchemy] Re: Uppercase column names in table.insert({ })

2008-09-29 Thread Michael Bayer
This is the expected behavior. SQLA operates in a case sensitive fashion whenever a table or column identifier is given in mixed case or upper case. Use all lower case for case insensitive. Since SQLA seeks to provide a database-agnostic API to the backend, this includes Oracle as

[sqlalchemy] Re: how to join tables properly

2008-09-29 Thread Ksenia
Hi Alex, Thanks a lot for your help! This is exactly what I needed. I almost gave it up before and started to write plain SQL to get the desired results ;) Works like a charm now. In case anyone interested, I am pasting the results below (BTW it's an interface to a (custom) table from Roundup

[sqlalchemy] Re: Uppercase column names in table.insert({ })

2008-09-29 Thread Itamar Ravid
Thanks for the answer, Mike. I was used to Oracle's behavior while writing raw SQL, in which the case of unquoted column identifiers doesn't matter. This behavior seems reasonable enough, although the inconsistency between the cursor description and SQLA's column identifiers could throw some

[sqlalchemy] Declarative and common fields

2008-09-29 Thread Joril
Hi everyone! I'm new to SQLAlchemy and I'm using version 0.5rc1.. I need every entity class to have a few common fields, so I tried writing an abstract base class, declarative-style, that every other entity class would subclass. So for example: --- from sqlalchemy.ext.declarative import

[sqlalchemy] Re: Declarative and common fields

2008-09-29 Thread az
i dont know if elixir has such 'attribute/behaviour injectors', i have DBCOOK_no_mapping=True in dbcook.sf.net that does that. the machinery behdin it is soewhat tricky (x in class.__dict__ and not in base_class.__dict__ etc stuff) u may try your stuff as mixin, that may or may not work. On

[sqlalchemy] Re: Declarative and common fields

2008-09-29 Thread Gaetan de Menten
On Mon, Sep 29, 2008 at 5:01 PM, Joril [EMAIL PROTECTED] wrote: Hi everyone! I'm new to SQLAlchemy and I'm using version 0.5rc1.. I need every entity class to have a few common fields, so I tried writing an abstract base class, declarative-style, that every other entity class would

[sqlalchemy] Re: Declarative and common fields

2008-09-29 Thread Joril
I don't know whether this is currently possible with Declarative or not. In the case it isn't, patching Declarative should be quite easy (but I don't know if such a patch would be accepted or not). I see.. I'll wait a bit then, maybe one of the developers will tell us if it'd be acceptable :)

[sqlalchemy] Re: Declarative and common fields

2008-09-29 Thread Michael Bayer
On Sep 29, 2008, at 11:01 AM, Joril wrote: Hi everyone! I'm new to SQLAlchemy and I'm using version 0.5rc1.. I need every entity class to have a few common fields, so I tried writing an abstract base class, declarative-style, that every other entity class would subclass. So for example:

[sqlalchemy] Re: realize a join between two tables over a mediate table - SQLAlchemy-0.4.7

2008-09-29 Thread Michael Bayer
On Sep 29, 2008, at 1:38 PM, [EMAIL PROTECTED] wrote: Hello, I'm using 'SQLAlchemy-0.4.7' and I want to realize a join between two tables over a mediate table. So I have written following code: --- class MSanctionEntity(Mapper): class_name =

[sqlalchemy] realize a join between two tables over a mediate table - SQLAlchemy-0.4.7

2008-09-29 Thread kai . krackler
Hello, I'm using 'SQLAlchemy-0.4.7' and I want to realize a join between two tables over a mediate table. So I have written following code: --- class MSanctionEntity(Mapper): class_name = 'hapo.common.entity.SanctionEntity' table_name = 'ent_entity'

[sqlalchemy] Re: how to join tables properly

2008-09-29 Thread Michael Bayer
On Sep 28, 2008, at 6:38 PM, Ksenia wrote: Hi list, I can't figure out a very simple thing. All I want is to do this query: select table1.A, table2.B, table3.C from table1, table2, table3 where table1.foreignkey2 = table2.primarykey and table1.foreignkey3 = table3.primarykey; When

[sqlalchemy] mysql to sqlalchemy table definition in .py file?

2008-09-29 Thread Lukasz Szybalski
Hello, I've asked this about 6 months ago and I was wondering if there was any progress I have existing mysql database, and I would like to connect to it via sqlalchemy using autoload and generate a python file style schema out of it. I want to migrate my existing mysql database to a

[sqlalchemy] SQLAlchemy usage in TurboGears

2008-09-29 Thread Christoph Zwerschke
Hi Michael, we're just discussing some issues with SQLAlchemy over at the TurboGears mailing list which appeared because the new SQLAlchemy usage as promoted in the 0.5 docs differs from the classical usage. We are unsure how to solve these issues, so I thought it will be best to get some

[sqlalchemy] mysql, use password from my.cnf file

2008-09-29 Thread Tom H
Depending on security preferences, it may be desirable to keep database passwords out of code files. One of the recommendations for MySQL is to keep the password in a .my.cnf file accessible only to the user. http://dev.mysql.com/doc/refman/5.0/en/password-security.html To use the .my.cnf

[sqlalchemy] Re: SQLAlchemy usage in TurboGears

2008-09-29 Thread Michael Bayer
On Sep 29, 2008, at 5:22 PM, Christoph Zwerschke wrote: Hi Michael, we're just discussing some issues with SQLAlchemy over at the TurboGears mailing list which appeared because the new SQLAlchemy usage as promoted in the 0.5 docs differs from the classical usage. We are unsure how

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-29 Thread John Hampton
Rick Morrison wrote: The first step here is to get a full binary round trip working with only pyodbc, no SQLA in use. Well, that's how I got as far as I did, but that was with straight text, no bind params I did a little more digging into this and found out that pyodbc with straight