[sqlalchemy] is it reasonable to have a __getattr__ method in class inheriting from declarative_base ?

2009-01-15 Thread rich
Hello, I discovered SQLAlchemy yesterday, and have been trying to figure out if its worth using as I rewrite my clunky code to maintain sql records of parameter values of expensive data structures (large numpy arrays) stored in Python shelves. It looks fantastic, but not sure yet that it is the

[sqlalchemy] Re: mysql udfs

2009-01-15 Thread az
try func.yourfuncname(..) ? On Thursday 15 January 2009 03:18:51 clb wrote: Hi, I have been scouring the sqlalchemy 0.5 documentation and can't seem to find information on how to execute UDFs. I am dealing with the following scenario: 1. I create a UDF (for example, get_fav_id, which

[sqlalchemy] Re: Column('last_updated', onupdate=func.current_timestamp())

2009-01-15 Thread Michael Bayer
its not working. make sure you do in fact have the onupdate configured on the correct Column/Table, etc. On Jan 14, 2009, at 10:50 PM, atomburner wrote: Thank you for such a prompt response. Per the excellent documentation I added the following four lines to my .py script: import

[sqlalchemy] Re: Error: attribute refresh operation cannot proceed

2009-01-15 Thread koranthala
On Jan 15, 2:37 am, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 14, 2009, at 3:01 PM, koranthala wrote: I understood your point and tried updating my code as mentioned. My code is a medium complex one - ~2K lines A problem that I see is that since I take the object and use it

[sqlalchemy] returning values as a list of values rather than as list of tuples

2009-01-15 Thread Faheem Mitha
Hi, The following code returns a list of tuples to python from the db, corresponding to the values of the 'snpval_id' column in the table 'cell'. I was wondering if there was an easy way to have it return a list of values (in this case, integers) instead.

[sqlalchemy] Re: returning values as a list of values rather than as list of tuples

2009-01-15 Thread Matthew Zwier
Hi Faheem, On Thu, Jan 15, 2009 at 11:05 AM, Faheem Mitha fah...@email.unc.edu wrote: Hi, The following code returns a list of tuples to python from the db, corresponding to the values of the 'snpval_id' column in the table 'cell'. I was wondering if there was an easy way to have it

[sqlalchemy] Re: returning values as a list of values rather than as list of tuples

2009-01-15 Thread Faheem Mitha
On Thu, 15 Jan 2009, Matthew Zwier wrote: Hi Faheem, On Thu, Jan 15, 2009 at 11:05 AM, Faheem Mitha fah...@email.unc.edu wrote: Hi, The following code returns a list of tuples to python from the db, corresponding to the values of the 'snpval_id' column in the table 'cell'. I was

[sqlalchemy] cascade delete-orphan

2009-01-15 Thread GustaV
Hi all, I try to set up a many-to-many relation with an association object. But I want something not usual: I want the child object deleted when not owned by any parent anymore. This is for a messages/recipients relation: the message is useless when everybody removed it from its mailbox! I

[sqlalchemy] Re: cascade delete-orphan

2009-01-15 Thread az
i think i had similar configuration, and i did it like one link was using default cascading, the other was just 'all'. but i'm not sure if yours is same, and any way i got mine via trial and error. do play with the cascade options. also i'm not sure if u apply some cascade on a backref what

[sqlalchemy] Re: cascade delete-orphan

2009-01-15 Thread GustaV
Is it planned for 0.6? or earlier? Anyway thanks: I stop trying all the combinations right now! :) On 15 jan, 18:30, Michael Bayer mike...@zzzcomputing.com wrote: There's various error conditions we should have added in 0.5 but have not. We should look into raising warnings in 0.5 and

[sqlalchemy] Re: cascade delete-orphan

2009-01-15 Thread Michael Bayer
i just committed the two warnings just now. On Jan 15, 2009, at 12:49 PM, GustaV wrote: Is it planned for 0.6? or earlier? Anyway thanks: I stop trying all the combinations right now! :) On 15 jan, 18:30, Michael Bayer mike...@zzzcomputing.com wrote: There's various error conditions we

[sqlalchemy] pyprocessing erros with SA

2009-01-15 Thread mg
Hi, I am using SA inside of a couple of scripts that use pyprocessing to spawn off children. It looks like it's working, but occasionally I get some really odd errors. Here are the basics of the app: We are using the declarative layer, SA5, etc. At runtime, a parameter is passed in that gives the

[sqlalchemy] creating indexes in MySQL

2009-01-15 Thread KevinTran
I have a quick question. I am trying to make an index for my table in MySQL. I have the line below: Index('index_table_on_field', table.c.field) I want to specify a length as in the SQL: KEY `index_table_on_field` (`field`(255)) Where do I enter the value 255 in the SQLAlchemy syntax?

[sqlalchemy] utf8 encoding issue in MySQL

2009-01-15 Thread KevinTran
I have the table definition below: urls = Table('url', meta, Column('id', Integer(11), primary_key=True), Column('address', Unicode(1024)), Column('content', Unicode(255)), mysql_engine='InnoDB' ) This will make the SQL below: CREATE TABLE `url` ( `id` int(11) NOT NULL

[sqlalchemy] Re: pyprocessing erros with SA

2009-01-15 Thread Michael Bayer
you should create a new engine per forked process, within the forked process, and bind it to the session.Using the connection pool from the parent process in a child fork does not produce behavior that's defined in any way I'm aware of (apparently the connections travel over for this

[sqlalchemy] Re: ORM base class for 0.5?

2009-01-15 Thread Bobby Impollonia
The declarative extension (sqlalchemy.ext.declarative) provides a __init__ that takes keyword args for attributes (at least it does in 0.4). On Tue, Jan 13, 2009 at 4:02 AM, Christoph Haas em...@christoph-haas.de wrote: Thanks for the code. For those who might also be interested in an ORM base

[sqlalchemy] Re: utf8 encoding issue in MySQL

2009-01-15 Thread Michael Bayer
I think this is configurable on the MySQL server directly, i.e. default charset, otherwise you can set it via **{'mysql_DEFAULT CHARSET':'utf8'} in your Table def. On Jan 15, 2009, at 3:17 PM, KevinTran wrote: I have the table definition below: urls = Table('url', meta,

[sqlalchemy] Re: creating indexes in MySQL

2009-01-15 Thread Michael Bayer
try using the DDL() construct instead. I dont think Index() supports that syntax. On Jan 15, 2009, at 3:10 PM, KevinTran wrote: I have a quick question. I am trying to make an index for my table in MySQL. I have the line below: Index('index_table_on_field', table.c.field) I want

[sqlalchemy] Re: returning values as a list of values rather than as list of tuples

2009-01-15 Thread Eric Ongerth
I've always thought this format for the list comprehension was particularly clean: result = [x for (x, ) in conn.execute(.).fetchall()] On Jan 15, 8:27 am, Faheem Mitha fah...@email.unc.edu wrote: On Thu, 15 Jan 2009, Matthew Zwier wrote: Hi Faheem, On Thu, Jan 15, 2009 at 11:05 AM,

[sqlalchemy] Re: cascade delete-orphan

2009-01-15 Thread GustaV
What is the best way to achieve the auto delete of the child then (refering to the example earlier)? I think about using an attribute extension... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To