[sqlalchemy] Re: convert_unicode problem

2007-10-09 Thread Moo
I've tried r3561 and r3577, the reflection is done with no errors. That's fine! But another error is occured on querying. Below is the traceback. -- Traceback (most recent call last): File model.py, line 24, in module

[sqlalchemy] Error (InvalidRequestError) when having tables with equally named primary key columns

2007-10-09 Thread Simon Pamies
Hi all, I have the following error: sqlalchemy.exceptions.InvalidRequestError: Column 'DownloadTopic.ID' is not available, due to conflicting property 'ID':sqlalchemy.orm.properties.ColumnProperty object at 0xb761732c when trying to access the topics field defined by the following model. It

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-10-09 Thread stephen emslie
Hi. I've been quiet on this for a while. I'm getting by without this behavior, though it would be nice to get a bit of clarity. Just to refresh, I've got an implementation very similar to the adjacency list example. Michael has helped me to eager load a subset of a node's children with a call to

[sqlalchemy] Re: Error (InvalidRequestError) when having tables with equally named primary key columns

2007-10-09 Thread Simon Pamies
Hi, I did some more investigation about this subject and found the source for this problem and perhaps some hints for people willing to help out with this problem: Around line 1002 of mapper.py there is a call to prop = self.columntoproperty[column] Why this fails? It seems because two

[sqlalchemy] Re: Problems with SELECT across two databases

2007-10-09 Thread Michael Bayer
On Oct 8, 2007, at 9:18 PM, jtm wrote: I know in MySQL i could just prepend the database names to specify the tables. How do I do this in sqlalchemy? (It could just be that my SQL-fu isn't quite up to the task.) use schema='dotproject' on your Table definition.

[sqlalchemy] Re: convert_unicode problem

2007-10-09 Thread Michael Bayer
On Oct 9, 2007, at 2:10 AM, Moo wrote: sqlalchemy.exceptions.DatabaseError: (DatabaseError) ORA-01036: 変数の名前/数 が無効です。 'SELECT emp_empno, emp_ename, emp_job, emp_mgr, emp_hiredate, emp_sal, emp_comm, emp_deptno \nFROM (SELECT emp.empno AS emp_empno, emp.ename AS emp_ename, emp.job AS

[sqlalchemy] Re: Error (InvalidRequestError) when having tables with equally named primary key columns

2007-10-09 Thread Simon Pamies
On Oct 9, 4:23 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 9, 2007, at 4:39 AM, Simon Pamies wrote: I have the following error: sqlalchemy.exceptions.InvalidRequestError: Column 'DownloadTopic.ID' is not available, due to conflicting property

[sqlalchemy] Re: Error (InvalidRequestError) when having tables with equally named primary key columns

2007-10-09 Thread Simon Pamies
On Oct 9, 7:09 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 9, 2007, at 12:33 PM, Simon Pamies wrote: I solved this problem by using autocode (and by the way I created an enhanced version of it called autocode4 - see http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode) and

[sqlalchemy] SQLAlchemy FlushError

2007-10-09 Thread jepr
Hi all, I have begun using SQLAlchemy in earnest for a database project I've begun, and I am running into some roadblocks with inserts of very simple objects. I have generated a very simple class to represent an entity called a Project: class Project(object): def __init__(self, project):

[sqlalchemy] Re: Error (InvalidRequestError) when having tables with equally named primary key columns

2007-10-09 Thread Michael Bayer
On Oct 9, 2007, at 12:33 PM, Simon Pamies wrote: I solved this problem by using autocode (and by the way I created an enhanced version of it called autocode4 - see http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode) and have no autoload=True anymore. seems like you guys should set

[sqlalchemy] Re: SQLAlchemy FlushError

2007-10-09 Thread jepr
I tested my hypothesis, and inactivated the trigger on the Project table, then added a Sequence('project_id_seq') to the project_id column in the project table definition, and the updates work like a charm. So, is it not permissible to have triggers set on tables if one is using SQLAlchemy?

[sqlalchemy] Re: SQLAlchemy FlushError

2007-10-09 Thread Michael Bayer
are you using Postgres ? if so, youd have to put a primary-key generating expression into your PassiveDefault. Psycopg2 gives us no good way to get back the newly generated ID from your trigger (only giving back OIDs, which according to PG docs are off by default and are deprecated:

[sqlalchemy] Re: SQLAlchemy FlushError

2007-10-09 Thread jepr
Hi Michael, No, I'm actually using Oracle. But, perhaps I should adopt the same methodology for it as well? Thanks! Joann On Oct 9, 1:52 pm, Michael Bayer [EMAIL PROTECTED] wrote: are you using Postgres ? if so, youd have to put a primary-key generating expression into your

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-10-09 Thread stephen emslie
Thanks for the quick response. Looking forward to the refactoring :) Stephen Emslie On 10/9/07, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 9, 2007, at 10:18 AM, stephen emslie wrote: Hi. I've been quiet on this for a while. I'm getting by without this behavior, though it would be

[sqlalchemy] Re: SQLAlchemy FlushError

2007-10-09 Thread Michael Bayer
On Oct 9, 2007, at 2:01 PM, jepr wrote: Hi Michael, No, I'm actually using Oracle. But, perhaps I should adopt the same methodology for it as well? cx_oracle doesnt even have a lastrowid attribute on its cursor, so yes the same idea applies. note this limitation only applies to the

[sqlalchemy] error when joining tables on multi-column primary key with bindparam

2007-10-09 Thread dihde14
I'm trying to write a select query which joins two tables. Let's say the first table is called 'users' and has a column called 'user_id'. Let's say the second table is called 'addresses' and has a two-column composite primary key on the columns ('user_id', 'address_type'). The 'address_type'

[sqlalchemy] Re: convert_unicode problem

2007-10-09 Thread Moo
I tried some patterns - NLS_LANG set/unset, convert_unicode True/ False, encoding set/unset - with logging.(r3578) As a result, I got almost the same exceptions and logs.(see below) In addition, that exception raises when 'filter_by' with 'NUMBER' columns too. So, I think the latest problem does