[sqlalchemy] How can i build a connection wtih Persistent

2010-04-08 Thread edward
Hi,all I have a cronjob to run,and it may be executed over half an hour... but at 10 min I found i lost connection from mysql,And How can i build a connection wtih Persistent? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this

[sqlalchemy] mapper for ms sql server

2010-04-08 Thread Tan Yi
Hello. Recently I have been working on this environment: linux + pyodbc + sqlalchemy 5.8 + ms sql server. In the program, I try to build a mapper from a db table to my python class, then I instatiate the class, and try to use session.add() to insert record to database. However, I need to have "alt

Re: [sqlalchemy] label()

2010-04-08 Thread Michael Bayer
Thomas Heller wrote: > I'm doing my first steps with sqlalchemy - a really great package? > > Here is my question: > > I know already how to label columns or functions that I'm querying for, > like this: > > session.query(count().label("foo"), MyClass.id.label("my_id")) > > How can I label the resu

[sqlalchemy] label()

2010-04-08 Thread Thomas Heller
I'm doing my first steps with sqlalchemy - a really great package? Here is my question: I know already how to label columns or functions that I'm querying for, like this: session.query(count().label("foo"), MyClass.id.label("my_id")) How can I label the result when I search for a class? This d

Re: [sqlalchemy] NameError: global name 'exc' is not defined (0.6beta3)

2010-04-08 Thread David Gardner
Thanks, I took a clone from hg, and all of my unit tests are passing now, and 0.6 is working great. I ran into one instance (I don't think this is a bug) where session.expire_all() didn't clear out an object after a call to Query.delete(synchronize_session=False), but I found that using sessio

Re: [sqlalchemy] binding values for the in() statement

2010-04-08 Thread Michael Bayer
Tarek Ziadé wrote: > Hello, > > I am trying to bind a list for an in() operator in a pure SQL query : > import sqlalchemy engine = create_engine('mysql://localhost/database') connection = engine.connect() connection.execute(engine.text("select * from user where email in (:e

[sqlalchemy] binding values for the in() statement

2010-04-08 Thread Tarek Ziadé
Hello, I am trying to bind a list for an in() operator in a pure SQL query : >>> import sqlalchemy >>> engine = create_engine('mysql://localhost/database') >>> connection = engine.connect() >>> connection.execute(engine.text("select * from user where email in >>> (:emails)"), emails=['ta...@ziad

Re: [sqlalchemy] mixins vs single table inheritence

2010-04-08 Thread Chris Withers
Michael Bayer wrote: are you wondering*why* this happens ? its because your mixin is giving all classes a __tablename__. Well, that's only a symptom of the problem, here's another example: def test_mapper_args_single_table(self): class CommonColumns: id = Column(

Re: [sqlalchemy] mixins vs single table inheritence

2010-04-08 Thread Michael Bayer
Chris Withers wrote: > Hi Again, > > So here's a test case ready to drop onto the end of test_declarative.py: > > def test_mapper_args_single_table(self): > > class TableNameMixin: > @classproperty > def __tablename__(cls): > return cls.__nam

Re: [sqlalchemy] SQLAlchemy.func.max()

2010-04-08 Thread Michael Bayer
jose soares wrote: > Michael Bayer wrote: >> jo wrote: >> >>> I was using heavily the column_prefix and my code is full of it, as >>> in: >>> >>> mapper(Anagrafica, >>> tbl['anagrafica'], >>> column_prefix = 'anagrafica_', >>> extension=History(), >>> properties =

[sqlalchemy] mixins vs single table inheritence

2010-04-08 Thread Chris Withers
Hi Again, So here's a test case ready to drop onto the end of test_declarative.py: def test_mapper_args_single_table(self): class TableNameMixin: @classproperty def __tablename__(cls): return cls.__name__.lower() class CommonColumns:

Re: [sqlalchemy] SQLCLCHEMY -WINDOWS

2010-04-08 Thread werner
On 08/04/2010 15:02, werner wrote: Hi, On 08/04/2010 08:18, prateeksha wrote: Hi, I am a student and I am working on a project which uses python, sqlalchemy and psqlite on windows. The problem is python is running fine but I am not able to use sqlalchemy. I have tries searching but no lin

Re: [sqlalchemy] SQLCLCHEMY -WINDOWS

2010-04-08 Thread werner
Hi, On 08/04/2010 08:18, prateeksha wrote: Hi, I am a student and I am working on a project which uses python, sqlalchemy and psqlite on windows. The problem is python is running fine but I am not able to use sqlalchemy. I have tries searching but no links give proper working steps to be f

[sqlalchemy] SQLCLCHEMY -WINDOWS

2010-04-08 Thread prateeksha
Hi, I am a student and I am working on a project which uses python, sqlalchemy and psqlite on windows. The problem is python is running fine but I am not able to use sqlalchemy. I have tries searching but no links give proper working steps to be followed in WINDOWS. Could someone please tell

[sqlalchemy] Re: relation to arbitrary class (hibernate )

2010-04-08 Thread Tvrtko
On Apr 7, 9:29 pm, "Michael Bayer" wrote: > Tvrtko wrote: > > I have a schema that cannot be changed. In it, there is a table with > > two columns: > > >     element_type CHAR(1) > >     element_id INTEGER > > > There is no foreign key on element_id because it can point to > > different, unrelated

Re: [sqlalchemy] SQLAlchemy.func.max()

2010-04-08 Thread jose soares
Michael Bayer wrote: jo wrote: I was using heavily the column_prefix and my code is full of it, as in: mapper(Anagrafica, tbl['anagrafica'], column_prefix = 'anagrafica_', extension=History(), properties = { 'comune' : relation( Comune, p