[sqlalchemy] rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
something with lazy-relations, self-referential, but pointing to another instance, not to _itself_. Happens regardless of inheritance. 2308 is all-ok, 2344 is same as 2309. hmm, what should i do to this all-combination test, so it gets included it in the testsuite? i.e. make it unittest-like

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
And another one - at same revision - maybe same thing? IMO the UPDATE for a lazy post_update relations gets the dbapi values swapped, e.g. (sqlite) rev2308: SA: INFO UPDATE Person SET friend_id=? WHERE Person.db_id = ? * SA: INFO [2, 7] rev2309-2344: * SA: INFO UPDATE Person SET

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
sorry, on more file needed something with lazy-relations, self-referential, but pointing to another instance, not to _itself_. Happens regardless of inheritance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: py2exe sqlalchemy

2007-02-20 Thread Something Special
I personally use latest python On 2/17/07, Ali [EMAIL PROTECTED] wrote: Yes, I imagined something like that. I only posted to avert users from norcebo effect that they might encounter reading this thread. On Feb 17, 5:16 pm, Michael Bayer [EMAIL PROTECTED] wrote: if you didnt have to

[sqlalchemy] Get error: 'list' object has no attribute 'accept_visitor'

2007-02-20 Thread vinjvinj
I'm getting the following error when I build the select clause. select_columns = [table.c.col1, table.c.col2] statement = table.select(select_columns) File build\bdist.win32\egg\sqlalchemy\sql.py, line 1351, in select File build\bdist.win32\egg\sqlalchemy\sql.py, line 65, in select

[sqlalchemy] Delete Problems

2007-02-20 Thread Brad Lindsay
I'm new to SQLAlchemy, and am currently using it for Turbogears developement. I've run into an issue calling delete on an instance. This almost exact same code works fine in one of my projects, but I get an error in this particular one. I think it may have be because this is a many-to-many

[sqlalchemy] Re: Get error: 'list' object has no attribute 'accept_visitor'

2007-02-20 Thread Sébastien LELONG
select_columns = [table.c.col1, table.c.col2] statement = table.select(select_columns) You probably want to: select_columns = [table.c.col1, table.c.col2] statement = sqlalchemy.select(select_columns) res = statement.execute().fetchall() # or the like... The table.select form you try to

[sqlalchemy] Re: Get error: 'list' object has no attribute 'accept_visitor'

2007-02-20 Thread vinjvinj
Ok. I need to do the following: select col1, col2, sum(col3), sum(col4) where col1 = test group by col1, col2 Q1: How do I add sum functions in the column list Q2: Do I add group_by using the group_by parameter on the sqlalchemy.select call Q3: Do I add where conditions to the select using

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread Michael Bayer
I cant run the generator since theres a dependency Config not found, but the standalones are using the foreignkey parameter which is both deprecated and also more or less mutually exclusive with remote_side. the trunk now has the foreign_keys parameter which behaves consistently as a

[sqlalchemy] Re: Delete Problems

2007-02-20 Thread Michael Bayer
this is something related to how turbogears is integrating SQLAlchemy. there might be a bug in SA here but I cant track it down without an example that shows what TG is doing more specifically. in particular i hope they are using the QueuePool connection pool and not the

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread Michael Bayer
yeah actually foreignkey's legacy behavior is fine, those examples are using it exactly incorrectlythe parameter takes on a different meaning when used in a self-ref relationship (thats why its been replaced) - its synonymous with remote_side in a self-ref relationship. On Feb 20,

[sqlalchemy] Re: Get error: 'list' object has no attribute 'accept_visitor'

2007-02-20 Thread che
seems the following will do the job: group_columns = [table.c.col1, table.c.col2] select_columns = group_columns + [sqlalchemy.func.sum(table.c.col3), sqlalchemy.func.sum(table.c.col4)] statement = sqlalchemy.select( select_columns, (table.c.col1 == test), group_by=group_columns) res =

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread Michael Bayer
foreignkey is out. dont use it at all. remote_side, when the remote side of the relationship is ambiguous based on the join condition, i.e. a self referential mapping relationship. can be provided for otherwise non-ambiguous cases as well. foreign_keys, when your join condition contains

[sqlalchemy] Multiple Foreign Keys to the same table, problems with second object.

2007-02-20 Thread Ali
Hi, I am using the recipe for multiple foreign keys to the same table at http://www.sqlalchemy.org/trac/wiki/UsageRecipes/MultiFkRelations I am also using SessionContext, and assign_mapper It works well, except for one issue. The second object (ie that which the second foreign key references)

[sqlalchemy] Re: Multiple Foreign Keys to the same table, problems with second object.

2007-02-20 Thread Michael Bayer
On Feb 20, 12:01 pm, Ali [EMAIL PROTECTED] wrote: Here is my code (with other fields removed): stockreceipt_table = Table('stockreceipt', meta, Column('user_id', Integer, ForeignKey('user.id')), # Cancellation Column('cancelled_user_id', Integer, ForeignKey('user.id')), )

[sqlalchemy] Re: Multiple Foreign Keys to the same table, problems with second object.

2007-02-20 Thread Ali
I left out the fields for brevity of example. They both have an id column defined as primary keys. On 20 Feb, 17:11, Michael Bayer [EMAIL PROTECTED] wrote: On Feb 20, 12:01 pm, Ali [EMAIL PROTECTED] wrote: Here is my code (with other fields removed): stockreceipt_table =

[sqlalchemy] Re: Multiple Foreign Keys to the same table, problems with second object.

2007-02-20 Thread Ali
By both, I mean user and receipt tables On 20 Feb, 17:12, Ali [EMAIL PROTECTED] wrote: I left out the fields for brevity of example. They both have an id column defined as primary keys. On 20 Feb, 17:11, Michael Bayer [EMAIL PROTECTED] wrote: On Feb 20, 12:01 pm, Ali [EMAIL PROTECTED]

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread svilen
using the foreignkey parameter which is both deprecated and also more or less mutually exclusive with remote_side. specifying foreign_keys explicitly, _and_ remote_side does work. here the last fixed variant. but if u comment out foreign_keys and lave only remote_side, in cases like B

[sqlalchemy] Re: Asynchronous SQLAlchemy--Anybody using Twisted, sAsync?

2007-02-20 Thread David Bolen
Matt Culbreth [EMAIL PROTECTED] writes: I'm playing out with a few things now and I wanted to see if anyone else has used SQLAlchemy in an asynchronous manner? For example, you could create a service which responded to asynchronous requests for data, and could be used by a web client,

[sqlalchemy] Re: rev2309 breaks some of the A-B ref/inh cases

2007-02-20 Thread Michael Bayer
the current error message is: raise exceptions.ArgumentError(Cant determine relation direction for relationship '%s' - foreign key columns are present in both the parent and the child's mapped tables. Specify 'foreign_keys' argument. %(str(self))) are u on trunk ?

[sqlalchemy] Tool to autogenerate code from db schema

2007-02-20 Thread Sean Davis
Just a quick question, but is there code available to autogenerate code for SA or Elixir from an existing (rather large) database? I could use SQLSoup directly, but it really helps me to be able to see the generated code. Also, some of the classes will benefit from some added methods. Thanks,

[sqlalchemy] Re: Three questions from first usage

2007-02-20 Thread Michael Bayer
On Feb 20, 12:18 pm, David Bolen [EMAIL PROTECTED] wrote: Michael Bayer [EMAIL PROTECTED] writes: I suppose in this case where I've got a better handle on the object actually being changed (the one being saved()), that expunging that one object might be the most effective approach, and is

[sqlalchemy] Re: Multiple Foreign Keys to the same table, problems with second object.

2007-02-20 Thread Ali
Ok, from sqlalchemy import * from sqlalchemy.ext.assignmapper import assign_mapper from sqlalchemy.ext.sessioncontext import SessionContext meta = DynamicMetaData() ctx = SessionContext(create_session) def make_engine(uri=None): if uri is None: uri = 'sqlite:///:memory:'

[sqlalchemy] Re: Multiple Foreign Keys to the same table, problems with second object.

2007-02-20 Thread Michael Bayer
well I cant run the program since its not complete (no Drug, Supplier class/tables defined, etc), but if id hazard a guess id say you shouldnt be calling flush() on your class instances, since it will not flush any changes on any dependencies. call ctx.current.flush() instead. On Feb

[sqlalchemy] Re: Multiple Foreign Keys to the same table, problems with second object.

2007-02-20 Thread Ali
Thanks for the advice, and sorry I didn't provide the correct information, but ctx.current.flush() makes no difference. r.cancelled_user is (nearly: 19/20) always None immediately after the assign and flush with no database access being made. Interestingly, the user_id/user relationship is always

[sqlalchemy] Suggestion to support full outer joins

2007-02-20 Thread Jonathan Ellis
Instead of isouter argument to Join, have join_type. Default to 'inner' but could also be 'left', 'right', or 'outer.' (Or even 'natural' but that might be confusing b/c of Join's default behavior of joining by FK which is similar to but not the same as natural join.) (Of course, it's quite

[sqlalchemy] Re: Suggestion to support full outer joins

2007-02-20 Thread Jonathan Ellis
On 2/20/07, Jonathan Ellis [EMAIL PROTECTED] wrote: Instead of isouter argument to Join, have join_type. Default to 'inner' but could also be 'left', 'right', or 'outer.' should read ... or 'full,' of course. --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] Re: Suggestion to support full outer joins

2007-02-20 Thread Michael Bayer
ive no problem with that feature, it was a TODO for sometime that got whacked from the sql.py module. feel free to patch this up, though its a lot of work - to get it working on Oracle in ANSI mode using (+), maybe get DB's that dont support FULL OUTER JOIN to raise an error, etc.

[sqlalchemy] Using Oracle hints with SQLAlchemy's ORM

2007-02-20 Thread erez
Hi, I have performance issues when trying to upload a large amount of data to my Oracle db using SQLAlchemy's ORM. My DBA told me to add a hint /*+APPEND*/ to my insert DML statment, but I couldn't find a way in SQLAlchemy to add a hint to the DML generated by the ORM. I searched google but to