[sqlalchemy] bulk insert

2008-04-24 Thread Grimsqueaker
Hi, I'm new to this group - here's my question, I've been fighting with this for a while now I need to insert a list of lists into a database. It works using a for loop but this is very slow so I want to optimize it. The method of bulk inserting in SQLAlchemy is much faster but only seems to

[sqlalchemy] Re: bulk insert

2008-04-24 Thread Michael Bayer
On Apr 24, 2008, at 2:23 AM, Grimsqueaker wrote: Hi, I'm new to this group - here's my question, I've been fighting with this for a while now I need to insert a list of lists into a database. It works using a for loop but this is very slow so I want to optimize it. The method of bulk

[sqlalchemy] Re: Reflecting tables, Unicodecolumnames and orm.mapper()

2008-04-24 Thread Saibot
Thank you for your help. I followed your advice and have overwritten the colums with umlauts with ascii-compatible names: Table('foo', metadata, Column(usomeunicodename, key=someasciiname), autoload=True ) To test this, i tried a select on my table, which resulted in another

[sqlalchemy] Re: Reflecting tables, Unicodecolumnames and orm.mapper()

2008-04-24 Thread Michael Bayer
On Apr 24, 2008, at 9:45 AM, Saibot wrote: Thank you for your help. I followed your advice and have overwritten the colums with umlauts with ascii-compatible names: Table('foo', metadata, Column(usomeunicodename, key=someasciiname), autoload=True ) OK the next step is to set the

[sqlalchemy] How to lock tables in mysql with SqlAlchemy?

2008-04-24 Thread Ting Zhou
Dear All, I would like to lock a table like LOCK TABLES table_name in mysql command. How can I do that with SqlAlchemy. I have defined a class |//|//|class Pointer(Entity): using_options(tablename='Pointer',autosetup=True) id=Field(MSInteger,primary_key=True) ||I need to lock table

[sqlalchemy] Re: ODBC Connection is busy error

2008-04-24 Thread Paul Johnston
Hi, Since our system went live we have been getting more more errors like this: DBAPIError: (Error) ('HY000', '[HY000] [Microsoft][SQL Native Client]Connection is busy with results for another command (0)') u'SELECT ...snip valid SQL string...endsnip I've seen this error too, in fact some

[sqlalchemy] Re: ODBC Connection is busy error

2008-04-24 Thread Rick Morrison
perhaps we could simply reset the pyodbc cursor before issuing a new SQL operation? class MSSQLExecutionContext(default.DefaultExecutionContext): def pre_exec(self): if self.dialect.clear_previous_results: self.cursor.clear_previous_results_somehow_idunnohow()

[sqlalchemy] Re: ODBC Connection is busy error

2008-04-24 Thread Michael Bayer
On Apr 24, 2008, at 1:04 PM, Paul Johnston wrote: Hi, Since our system went live we have been getting more more errors like this: DBAPIError: (Error) ('HY000', '[HY000] [Microsoft][SQL Native Client]Connection is busy with results for another command (0)') u'SELECT ...snip valid SQL

[sqlalchemy] filter_by mapped class attribute?

2008-04-24 Thread Matt
I have 2 classes A and B which are mapped each to their own table. There is a foreign key which defines a one to many relationship from A to B. Is it possible to query B, but filter on an attribute of A? ctx.current.query(B).filter_by(A.c.name.like('%foo%')) This seems to work, but the query

[sqlalchemy] Summer Python Internship - National Renewable Energy Laboratory

2008-04-24 Thread percious
Student Intern – Scientific Computing Group 5900 5900-7259 A student internship is available in the National Renewable Energy Laboratory's (NREL) Scientific Computing Group. NREL is the nation's primary laboratory for research, development and deployment of renewable energy and energy

[sqlalchemy] Re: How to lock tables in mysql with SqlAlchemy?

2008-04-24 Thread jason kirtland
Ting Zhou wrote: Dear All, I would like to lock a table like LOCK TABLES table_name in mysql command. How can I do that with SqlAlchemy. I have defined a class |//|//|class Pointer(Entity): using_options(tablename='Pointer',autosetup=True) id=Field(MSInteger,primary_key=True)

[sqlalchemy] Re: filter_by mapped class attribute?

2008-04-24 Thread Matt
ctx.current.query(B).filter_by(A.c.name.like('%foo%')) added the join manually: ctx.current.query(B).filter(B.c.xid == A.c.xid).filter_by(A.c.name.like('%foo%')) m On Apr 24, 2:33 pm, Matt [EMAIL PROTECTED] wrote: I have 2 classes A and B which are mapped each to their own table. There is

[sqlalchemy] Re: filter_by mapped class attribute?

2008-04-24 Thread Michael Bayer
On Apr 24, 2008, at 6:53 PM, Matt wrote: ctx.current.query(B).filter_by(A.c.name.like('%foo%')) added the join manually: ctx.current.query(B).filter(B.c.xid == A.c.xid).filter_by(A.c.name.like('%foo%')) in 0.3, also consider query(B).join('arelation').filter(A.c.name=='foo') a lot

[sqlalchemy] Re: ODBC Connection is busy error

2008-04-24 Thread BruceC
Thank you to everybody for your comments on this problem... Michael, re: your suggestion about result.close(), is this something that I could add to mssql.py, or do you think it's something that I would need to add throughout my application everytime I access the db? (It's a big application...)