[sqlalchemy] Re: queuepool timeout's with mod_wsgi under heavier load

2010-01-15 Thread Graham Dumpleton
FWIW, thread on mod_wsgi list about this is at: http://groups.google.com/group/modwsgi/browse_frm/thread/c6e65603c8e75a30 Graham On Jan 15, 4:10 am, Michael Bayer mike...@zzzcomputing.com wrote: Damian wrote: Hi, Every few days, when we experience higher loads we get sqlalchemy's

[sqlalchemy] MySQL Connector and BIT test case (+patch)

2010-01-15 Thread geertjanvdk
Hello, We had a problem with BIT data types in MySQL Connector/Python. A fix was pushed today, but I can't still make this test_bit_50 (here below) work. It appears that what gets back from MySQL through RowProxy(?) is 'empty'. If anyone can hit me with the cluebat to figure out what's wrong?

[sqlalchemy] Book

2010-01-15 Thread werner
Researching TurboGears stuff I came across a page on Amazon. Sqlalchemy: Database Access Using Python (Broché) de Mark Ramm (Auteur), Michael Bayer (Auteur) To be available in Feb 2010. Is it really that close? Werner -- You received this message because you are subscribed to the Google

[sqlalchemy] Re: using merge() with composite key

2010-01-15 Thread Kent
you need to flip around where you put the delete-orphan rule - see my previous email on the subject. In other words: order_mapper = mapper(Order, order_table, properties=dict (orderdetails=relation(OrderDetail, cascade='all,delete-orphan', single_parent=True,

[sqlalchemy] Re: Column property vs. Python (class) property for calculated columns

2010-01-15 Thread bojanb
Thanks Mike. I must admit I don't understand why that code works, but it does. I guess that's the Alchemy in SQLAlchemy :-) However, I have issues with the difference in NULL value semantics between Python and SQL. Ie. if a calculated column is defined via a column_property as price*amount, then

[sqlalchemy] finding the relation target class dynamically

2010-01-15 Thread Kent
Suppose you have a simple child-parent relationship defined as such: parent_mapper = mapper(Parent, parent_table, properties=dict(children=relation(Child))) I would like to use introspection on the Parent obj to dynamically determine that its children property is a collection of

[sqlalchemy] Name clash in SqlSoup

2010-01-15 Thread PauloS
Hi all, I have a postgres table with a column named query. This seems to conflict with builtin 'query' property from the SqlSoup instance. print db.ahr_relat._table.c.has_key('query') True print db.ahr_relat.c.has_key('query') False print db.ahr_relat.query sqlalchemy.orm.scoping.query object

[sqlalchemy] Joined table inheritance without a discriminator

2010-01-15 Thread Ian
All, I have two applications: one uses Python with Sqlalchemy and the other uses Java with Hibernate. There is a slight mis-match between the joined table inheritance strategy: with Hibernate a discriminator is not required. The Sqlalchemy documentation says, in the Joined Table Inheritance

[sqlalchemy] Prepared Statements in Postgresql

2010-01-15 Thread mozillalives
Hello Everyone, I am new to both sqlalchemy and elixir, but I have been using them for the past couple of weeks and I really like them. But I have a question about prepared statements for Postgresql. For one specific application, I am doing a bunch of inserts (200,000+). From what I can tell, it

Re: [sqlalchemy] Book

2010-01-15 Thread Michael Bayer
werner wrote: Researching TurboGears stuff I came across a page on Amazon. Sqlalchemy: Database Access Using Python (Broché) de Mark Ramm (Auteur), Michael Bayer (Auteur) To be available in Feb 2010. Is it really that close? its not. Werner -- You received this message because

Re: [sqlalchemy] Name clash in SqlSoup

2010-01-15 Thread Michael Bayer
PauloS wrote: Hi all, I have a postgres table with a column named query. This seems to conflict with builtin 'query' property from the SqlSoup instance. print db.ahr_relat._table.c.has_key('query') True print db.ahr_relat.c.has_key('query') False print db.ahr_relat.query

Re: [sqlalchemy] Joined table inheritance without a discriminator

2010-01-15 Thread Michael Bayer
Ian wrote: All, I have two applications: one uses Python with Sqlalchemy and the other uses Java with Hibernate. There is a slight mis-match between the joined table inheritance strategy: with Hibernate a discriminator is not required. The Sqlalchemy documentation says, in the Joined Table

Re: [sqlalchemy] Prepared Statements in Postgresql

2010-01-15 Thread Michael Bayer
mozillalives wrote: Hello Everyone, I am new to both sqlalchemy and elixir, but I have been using them for the past couple of weeks and I really like them. But I have a question about prepared statements for Postgresql. For one specific application, I am doing a bunch of inserts

[sqlalchemy] Table as dictionary?

2010-01-15 Thread Nelson
Hello SQLAlchemy experts, I'd like to view the contents of a table object as a dictionary. Example: s = Table('sparrow', Column('type', String(50)) , Column('weight', Integer), ... etc) s.type = 'African' s.weight = 32 Then I want to see / get a dictionary: {'type': 'African, weight: 32, ...

[sqlalchemy] Re: Prepared Statements in Postgresql

2010-01-15 Thread mozillalives
Thanks for your quick response Michael. To answer your question, this is how I was issuing the queries conn.execute(PREPARE insert_statement(text) AS ...) conn.execute(EXECUTE insert_statement('%s') % val) And I'm sorry if it seemed that I was attacking sqlalchemy, I just wasn't sure what it

Re: [sqlalchemy] Re: Prepared Statements in Postgresql

2010-01-15 Thread Michael Bayer
mozillalives wrote: Thanks for your quick response Michael. To answer your question, this is how I was issuing the queries conn.execute(PREPARE insert_statement(text) AS ...) conn.execute(EXECUTE insert_statement('%s') % val) And I'm sorry if it seemed that I was attacking sqlalchemy, I

Re: [sqlalchemy] Table as dictionary?

2010-01-15 Thread Kevin Horn
On Fri, Jan 15, 2010 at 11:28 AM, Nelson nelsonp...@comcast.net wrote: Hello SQLAlchemy experts, I'd like to view the contents of a table object as a dictionary. Example: s = Table('sparrow', Column('type', String(50)) , Column('weight', Integer), ... etc) s.type = 'African' s.weight =

Re: [sqlalchemy] Table as dictionary?

2010-01-15 Thread Antoine Pitrou
Le vendredi 15 janvier 2010 à 09:28 -0800, Nelson a écrit : Hello SQLAlchemy experts, I'd like to view the contents of a table object as a dictionary. Example: s = Table('sparrow', Column('type', String(50)) , Column('weight', Integer), ... etc) s.type = 'African' s.weight = 32 Then

[sqlalchemy] Mixing matching connectors and dialects in 0.6

2010-01-15 Thread Bo Shi
Hi All, I'm attempting to get rudimentary support for a Vertica deployment using an ODBC connector. According to their docs, their dialect is mostly compatible with Oracle and SQLServer dialects. create_engine() using 'mssql+pyodbc' seems to work but upon attempting to execute a simple select

[sqlalchemy] Re: Table as dictionary?

2010-01-15 Thread Nelson
On Jan 15, 11:15 am, Antoine Pitrou solip...@pitrou.net wrote: Le vendredi 15 janvier 2010 à 09:28 -0800, Nelson a écrit : Hello SQLAlchemy experts, I'd like to view the contents of a table object as a dictionary. s.__dict__ ? You'll have to filter out any private attributes set by

[sqlalchemy] how to do mysql insert delayed in sqlalchemy

2010-01-15 Thread Stephen
I didn't see anything in the docs or in this group so please forgive me if this has been asked already. If I'm using sqlalchemy with an underlying mysql db, how can I achieve INSERT DELAYED? I saw this changeset on the wiki: http://www.sqlalchemy.org/trac/changeset/4236 But I don't understand

Re: [sqlalchemy] Mixing matching connectors and dialects in 0.6

2010-01-15 Thread Michael Bayer
Bo Shi wrote: Hi All, I'm attempting to get rudimentary support for a Vertica deployment using an ODBC connector. According to their docs, their dialect is mostly compatible with Oracle and SQLServer dialects. That's funny because Oracle and SQL server are utterly, totally different from a

Re: [sqlalchemy] how to do mysql insert delayed in sqlalchemy

2010-01-15 Thread Michael Bayer
Stephen wrote: I didn't see anything in the docs or in this group so please forgive me if this has been asked already. If I'm using sqlalchemy with an underlying mysql db, how can I achieve INSERT DELAYED? I saw this changeset on the wiki: http://www.sqlalchemy.org/trac/changeset/4236

Re: [sqlalchemy] Mixing matching connectors and dialects in 0.6

2010-01-15 Thread Bo Shi
That's funny because Oracle and SQL server are utterly, totally different from a SQL quirks perspective.   If I were to pick two dialects in SQLA that were *most* different from each other and also non-standard, those would be the two. I was a bit puzzled by this also (granted this was from

Re: [sqlalchemy] how to do mysql insert delayed in sqlalchemy

2010-01-15 Thread Stephen Mullins
Cool thank you. I take it that means there's no way to do this if I'm just using a Base model and a session. I had been just doing: session.add(myobj) session.commit() where myobj is an instance of a model class that inherits from Base, I hadn't been creating Table objects directly. On Fri, Jan

Re: [sqlalchemy] how to do mysql insert delayed in sqlalchemy

2010-01-15 Thread Stephen Mullins
Oh ok that makes sense and I can easily use this. Thank you! On Fri, Jan 15, 2010 at 2:03 PM, Michael Bayer mike...@zzzcomputing.comwrote: Stephen Mullins wrote: Cool thank you. I take it that means there's no way to do this if I'm just using a Base model and a session. I had been just

[sqlalchemy] expire_on_commit=False running many load balanced instances of app

2010-01-15 Thread Ergo
I wanted to conftrm that if we run multiple instances of web application. then sessions in those applications are not aware of commits that are issued by other instances sessions, right? So expire_on_commit=True does not ensure coherency of data and just adds overhead, am i correct ? -- You

Re: [sqlalchemy] expire_on_commit=False running many load balanced instances of app

2010-01-15 Thread Michael Bayer
On Jan 15, 2010, at 9:16 PM, Ergo wrote: I wanted to conftrm that if we run multiple instances of web application. then sessions in those applications are not aware of commits that are issued by other instances sessions, right? So expire_on_commit=True does not ensure coherency of data and