[sqlalchemy] identifier is too long

2010-03-30 Thread jo
Hi all, I have some troubles creating my db schema with Oracle. The problem is on this column: Column('cod_caratteristica_rischio', Unicode(10), index=True, nullable=False) It works fine in PostgreSQL but when I try it on Oracle sa tries to create an index with a name too long ( 30 char).

[sqlalchemy] @compiles ignores inheritance

2010-03-30 Thread Tobias
Hi, I am having a bunch of classes that inherit from Function and all of them should be compiled by a method annotated with @compiles. class __base_function(Function): def __init__(self, clause, *clauses, **kw): self.clause = clause Function.__init__(self,

[sqlalchemy] add_column does not correlate with aliased table.

2010-03-30 Thread Kalium
Hi, I've had a look through the docs and a quick look through the forum here, and haven't been able to solve my problem. I'm using 0.4 The following works as expected. q = System.query().join('activity').group_by(model.System.id).add_column(func.max(Activity.id)) The add_column() recognises

Re: [sqlalchemy] identifier is too long

2010-03-30 Thread Mariano Mara
Excerpts from jo's message of Tue Mar 30 03:25:18 -0300 2010: Hi all, I have some troubles creating my db schema with Oracle. The problem is on this column: Column('cod_caratteristica_rischio', Unicode(10), index=True, nullable=False) It works fine in PostgreSQL but when I try it on

Re: [sqlalchemy] add_column does not correlate with aliased table.

2010-03-30 Thread Michael Bayer
On Mar 30, 2010, at 2:47 AM, Kalium wrote: Hi, I've had a look through the docs and a quick look through the forum here, and haven't been able to solve my problem. I'm using 0.4 The following works as expected. q =

[sqlalchemy] Column type in select w/ if condition

2010-03-30 Thread Bryan
The underlying column returns a Decimal object when queried regularly, and when summed as follows: select([ mytable.c.hours ]) Decimal(1.0) select([ func.sum(mytable.c.hours) ]) Decimal(1.0) ...but when I sum it w/ an if statement, it returns a float: select([ func.sum(func.if_(True,

Re: [sqlalchemy] identifier is too long

2010-03-30 Thread jo
I see, thank you, Mariano. j Mariano Mara wrote: Excerpts from jo's message of Tue Mar 30 03:25:18 -0300 2010: Hi all, I have some troubles creating my db schema with Oracle. The problem is on this column: Column('cod_caratteristica_rischio', Unicode(10), index=True, nullable=False)

Re: [sqlalchemy] Column type in select w/ if condition

2010-03-30 Thread Mariano Mara
Excerpts from Bryan's message of Tue Mar 30 11:27:57 -0300 2010: The underlying column returns a Decimal object when queried regularly, and when summed as follows: select([ mytable.c.hours ]) Decimal(1.0) select([ func.sum(mytable.c.hours) ]) Decimal(1.0) ...but when I sum it w/ an if

Re: [sqlalchemy] @compiles ignores inheritance

2010-03-30 Thread Michael Bayer
Tobias wrote: Hi, So I thought I could write just one method, that is annotated with @compiles(__base_function), but this does not work. I have to write a method for each class that inherits from __base_function: @compiles(wkt) def compile_wkt(element, compiler, **kw): return

[sqlalchemy] Re: Column type in select w/ if condition

2010-03-30 Thread Bryan
That worked, thanks. On Mar 30, 7:40 am, Mariano Mara mariano.m...@gmail.com wrote: Excerpts from Bryan's message of Tue Mar 30 11:27:57 -0300 2010: The underlying column returns a Decimal object when queried regularly, and when summed as follows: select([ mytable.c.hours ])

Re: [sqlalchemy] PyODBCConnector dbapi question

2010-03-30 Thread Bo Shi
pep 249 specifies list of tuples for fetchmany() and fetchall() Hrm, pep-249 seems to only specify sequence and sequence of sequences for the fetch*() functions, specifying list of tuples only as one possible example. Perhaps the C implementation of RowProxy is being too strict here? I'm

Re: [sqlalchemy] PyODBCConnector dbapi question

2010-03-30 Thread Michael Bayer
Bo Shi wrote: pep 249 specifies list of tuples for fetchmany() and fetchall() Hrm, pep-249 seems to only specify sequence and sequence of sequences for the fetch*() functions, specifying list of tuples only as one possible example. Perhaps the C implementation of RowProxy is being too

[sqlalchemy] best-practices question

2010-03-30 Thread Jon Nelson
Let's say I have a database with hundreds or even thousands of tables. The table structure for this set of tables is *exactly* the same. Furthermore, let's say the name of each table is predictable. For example, something like: tablename_2010_03_05 What I'd like to know is how to best manage

Re: [sqlalchemy] best-practices question

2010-03-30 Thread Michael Bayer
Jon Nelson wrote: Let's say I have a database with hundreds or even thousands of tables. The table structure for this set of tables is *exactly* the same. Furthermore, let's say the name of each table is predictable. For example, something like: tablename_2010_03_05 What I'd like to know

[sqlalchemy] Re: Restricting a delete based on a many-to-many mapping.

2010-03-30 Thread Rich
On Mar 29, 6:15 pm, Michael Bayer mike...@zzzcomputing.com wrote: you want the delete to fail if there *are* users associated or if there are *not* ?    for the raise an error if users exist, the most efficient and generic way is to ensure the foreign key on UserGroup is not nullable and

[sqlalchemy] Sharding with _BindParamClause

2010-03-30 Thread George V. Reilly
We're using SQLAlchemy sharding to partition accounts across a couple of databases. We want to add more partitions, but first we need to eliminate some unnecessary cross-partition queries. class FindShardableId(sqlalchemy.sql.ClauseVisitor): def __init__(self, ids, key_fields,

[sqlalchemy] Re: add_column does not correlate with aliased table.

2010-03-30 Thread Kalium
On Mar 30, 10:54 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Mar 30, 2010, at 2:47 AM, Kalium wrote: Hi, I've had a look through the docs and a quick look through the forum here, and haven't been able to solve my problem. I'm using 0.4 The following works as expected. q

Re: [sqlalchemy] best-practices question

2010-03-30 Thread Taavi Burns
Jon Nelson wrote: Let's say I have a database with hundreds or even thousands of tables. Sure you didn't mean hundreds OF thousands? :) On Tue, Mar 30, 2010 at 2:09 PM, Michael Bayer mike...@zzzcomputing.com wrote: def map_a_table(tablename):    table = Table(tablename, metadata,