[sqlalchemy] In Turbogears, using the same transaction for mapped objects and direct operations

2007-06-05 Thread Sanjay
Hi, In a turbogears application that I am developing, in a single transaction, I need to delete certain records of a table, and update another table. the code is something like: from sqlalchemy import * from turbogears import metadata, session . . .

[sqlalchemy] MySQL MaxDB interface for SQLAlchemy

2007-06-05 Thread Hermann Himmelbauer
Hi, It seems SQLAlchemy provides no database connector for MySQL's SAPDB/MaxDB database and that there is no ongoing work in this direction. I'm currently working on a project, which relies on MaxDB, therefore I need such a connector. As I am not involved in the SQLAlchemy development, writing

[sqlalchemy] on delete restrict

2007-06-05 Thread lingo
I'm using Sqlalchemy with PostgreSQL in a project. Some of the relations (foreign keys) in the database (postgresql) have ON_DELETE=RESTRICT which should prevent parent objects with existing child objects from being deleted (tested, works in pg client). The problem is that Sqlalchemy doesn't

[sqlalchemy] Re: max_identifier_length() test in ansisql.py

2007-06-05 Thread Eric V. Smith
Michael Bayer wrote: On Jun 4, 2007, at 9:58 PM, Eric V. Smith wrote: I'm new to this list. I've searched the archives, and could not find this issue addressed. Apologies if I've missed it. I'm using 0.3.8. In ansisql.py, the tests for max_identifier_length() are of the form: if

[sqlalchemy] Re: In Turbogears, using the same transaction for mapped objects and direct operations

2007-06-05 Thread Marco Mariani
Sanjay ha scritto: Need help on how to do it. Being a turbogears application where db entities like metadata and session are imported rather than created by me, I am confused and could not successfully implement the pattern provided in the docs. I'm sure there are cleaner ways, but this

[sqlalchemy] Re: on delete restrict

2007-06-05 Thread Michael Bayer
On Jun 5, 2007, at 6:39 AM, lingo wrote: I'm using Sqlalchemy with PostgreSQL in a project. Some of the relations (foreign keys) in the database (postgresql) have ON_DELETE=RESTRICT which should prevent parent objects with existing child objects from being deleted (tested, works in pg

[sqlalchemy] Re: on delete restrict

2007-06-05 Thread Michael Bayer
On Jun 5, 2007, at 11:20 AM, lingo wrote: now it looks like: Parent_table = sa.Table('Parent', metadata, autoload=True) Child_table = sa.Table('Child', metadata, autoload=True) orm.mapper(Parent,Parent_table, properties={ 'Children' : relation(Child, cascade=save-update) } )

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-05 Thread Michael Bayer
I want to wake this thread up again. can we get some arguments pro/ con to converting select() to work in a generative style ? generative means either just the first, or both of these two things: - methods like append_whereclause() return a select object with which to call further genreative

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-05 Thread sdobrev
hmm, actualy, in such select.append_whereclause().order_by().group_by().whatever1 ().whatever2()... What is the point of anything except the very first funccall to be generative? the direct results are thrown away, and the copies are used - whyfore? (i guess this applies to query() as

[sqlalchemy] Accessing tables in multiple databases with one connection (MSSQL)

2007-06-05 Thread desmaj
Hi Folks, In my current environment, I get one database connection per web application. That connection has to access tables in a data warehouse as well as an application specific database. Both databases live on the same SQL Server instance. It seems as though I can't use the sql generation

[sqlalchemy] Re: Accessing tables in multiple databases with one connection (MSSQL)

2007-06-05 Thread Rick Morrison
I don't think so, not directly. Short-term, here's a couple of things to try: -- you may be able to create views in the local database that reference the warehouse tables, and access these views as if they were local tables. -- you may be able to hack up something by using the schema support in

[sqlalchemy] Re: Accessing tables in multiple databases with one connection (MSSQL)

2007-06-05 Thread desmaj
Hi Rick, On Jun 5, 4:05 pm, Rick Morrison [EMAIL PROTECTED] wrote: I don't think so, not directly. I was afraid of this. Short-term, here's a couple of things to try: [snip suggestions] I appreciate the suggestions. I may see about adding a view for this purpose. We decided against it when

[sqlalchemy] Re: Accessing tables in multiple databases with one connection (MSSQL)

2007-06-05 Thread Michael Bayer
On Jun 5, 2007, at 4:05 PM, Rick Morrison wrote: I don't think so, not directly. Short-term, here's a couple of things to try: -- you may be able to create views in the local database that reference the warehouse tables, and access these views as if they were local tables. -- you

[sqlalchemy] Re: Accessing tables in multiple databases with one connection (MSSQL)

2007-06-05 Thread Rick Morrison
ah, well the owner attribute is news to me, and if that's already supported all the way through SA, and if the dialect can build the schema.owner.table string, then that's already a huge part of the way there. As for DBAPI concerns, I know that at least pymssql will take the database.owner.table

[sqlalchemy] Re: Boolean queries

2007-06-05 Thread Michael Bayer
On Jun 5, 2007, at 7:01 PM, Mike Orr wrote: Not sure if this is a bug or just how SQLAlchemy works. I have a table with an int field used as a boolean. I can do a positive query like this: q.filter(Incident.c.is_top)= WHERE `IN_Incident`.is_top But a negative query does not

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-05 Thread Huy Do
Michael Bayer wrote: I want to wake this thread up again. can we get some arguments pro/ con to converting select() to work in a generative style ? generative means either just the first, or both of these two things: - methods like append_whereclause() return a select object with which to

[sqlalchemy] like doesn't work with objects

2007-06-05 Thread Techniq
I'm going through the wiki cookbook http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+people+in+a+hurry and I'm discovering that even though 'model.class.c.column_name.like' is available it doesn't perform a LIKE in the query. from 'paster shell' In [20]:

[sqlalchemy] Re: In Turbogears, using the same transaction for mapped objects and direct operations

2007-06-05 Thread Huy Do
Marco Mariani wrote: Sanjay ha scritto: Need help on how to do it. Being a turbogears application where db entities like metadata and session are imported rather than created by me, I am confused and could not successfully implement the pattern provided in the docs. I'm sure

[sqlalchemy] How to most effectively associate child objects to parents upon _init__ (lookup tables)

2007-06-05 Thread John Lorance
I'm newish to SqlAlchemy and for the life of me I can't figure out how to properly set things up so that lookup tables(objects) are cached and/or it is easy for new parent objects to associate to their childing upon initialization. See below for code snippet and sample problem. from sqlalchemy

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-05 Thread Mike Orr
On 6/5/07, Michael Bayer [EMAIL PROTECTED] wrote: I want to wake this thread up again. can we get some arguments pro/ con to converting select() to work in a generative style ? generative means either just the first, or both of these two things: - methods like append_whereclause() return

[sqlalchemy] Re: How to most effectively associate child objects to parents upon _init__ (lookup tables)

2007-06-05 Thread Eric Ongerth
Hi John, Check out the doc section entitled Mapping a class with table inheritance: http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_inheritance Although it's not the only way to do it, you might be interested in polymorphic multiple-table inheritance, which SQLAlchemy already

[sqlalchemy] Re: like doesn't work with objects

2007-06-05 Thread Mike Orr
On 6/5/07, Techniq [EMAIL PROTECTED] wrote: I'm going through the wiki cookbook http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+people+in+a+hurry and I'm discovering that even though 'model.class.c.column_name.like' is available it doesn't perform a LIKE in the query. from

[sqlalchemy] Re: How to most effectively associate child objects to parents upon _init__ (lookup tables)

2007-06-05 Thread Eric Ongerth
What's more, I should have just said to look in your sqlalchemy subdirectory /examples/polymorph/polymorph.py. I forgot that's where I learned the above techniques a month ago... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the