Re: [sqlalchemy] subquery as column

2012-07-24 Thread Alessandro
Yes,I know, so simple... but it didn't work for me as far I didn't set the label for the internal select. I try it many times, but always without it; I didn't know it was mandatory. Thank you. first_id_row = s.query(Row.id_row).\ filter(Row.id_head ==

[sqlalchemy] ManyToMany query

2012-07-24 Thread Enrico Morelli
Dear all, I've the following tables: site_table = Table('site', metadata, Column('id', types.Integer, primary_key=True), Column('name', types.Unicode(15), nullable=False)) chain_table = Table('chain', metadata, Column('id', types.Integer, primary_key=True), Column('letter',

Re: [sqlalchemy] ManyToMany query

2012-07-24 Thread Michael Bayer
On Jul 24, 2012, at 11:25 AM, Enrico Morelli wrote: Dear all, I've the following tables: site_table = Table('site', metadata, Column('id', types.Integer, primary_key=True), Column('name', types.Unicode(15), nullable=False)) chain_table = Table('chain', metadata,

[sqlalchemy] Performance Mystery

2012-07-24 Thread Warwick Prince
Hi All This is addressed to anyone who may be able to shed some light on this strange behaviour; I'm running MySQL on Windows 2003 Server (Sorry) and have a table that has ~2M rows of sales data in it. Knowing the type of BI queries I would want to be doing, I have added indexes where I

Re: [sqlalchemy] Performance Mystery

2012-07-24 Thread Michael Bayer
One difference that exists here is the usage of bound parameters, which I'm assuming you're not using when you run the query in the console. What happens if you run a test script with straight mysqlconnector ? Try with and without the bound parameters. On Jul 24, 2012, at 11:50 PM,

[sqlalchemy] Issue with `filter_by`?

2012-07-24 Thread Amos
I've defined a column declaratively like so my_column = Column(Unicode(30), index=True, unique=True) If I pass in an integer instead of a string, it will actually return all records that start with the string representation of that integer [obj.code for obj in