Re: [sqlalchemy] Problems with 0.6beta1

2010-02-10 Thread Gaetan de Menten
On Wed, Feb 10, 2010 at 08:48, Chris chris.g@gmail.com wrote: Hi All Have just upgraded to this version and am having the following issue. I use a the execute method on a ScopedSession to run generic SQL Statements in a TextClause,  in the resulting BufferedRowResultProxy object their

Re: [sqlalchemy] Problems with 0.6beta1

2010-02-10 Thread Gaetan de Menten
On Wed, Feb 10, 2010 at 09:04, Gaetan de Menten gdemen...@gmail.com wrote: On Wed, Feb 10, 2010 at 08:48, Chris chris.g@gmail.com wrote: Hi All Have just upgraded to this version and am having the following issue. I use a the execute method on a ScopedSession to run generic SQL

[sqlalchemy] integer fields return long python type on query

2010-02-10 Thread Simone Orsi
Hi all, I have a lot of integer fields in a mysql db and when I query them I get always a long python type instead of an integer python type. Is quite annoying to convert long to int every time... how can I get rid of this? I remember that with mysql-python you can pass an instance of

[sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Kent
Thanks for the ticket 1681 consideration. Though my understanding of the software isn't strong enough to recommend (or understand) what you are suggesting in 1681, I can observe the behavior enough to wonder why do we need to go back to the database again? (Also, wondering if some databases

Re: [sqlalchemy] newbie to sqlalchemy :not null constraint

2010-02-10 Thread anusha kadambala
Thanks, Micheal for your help On Wed, Feb 10, 2010 at 9:53 AM, Michael Trier mtr...@gmail.com wrote: hello all, I am newbie in sqlalchemy.I am thrilled by the sqlachemy features. But i got struck in the how to write the not null for the following: create table organisation(orgcode

[sqlalchemy] creating views declarative base is confusing

2010-02-10 Thread anusha kadambala
hello all, I want to create view based on the following tables from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import

Re: [sqlalchemy] Problems with 0.6beta1

2010-02-10 Thread Michael Bayer
restored in r6742. On Feb 10, 2010, at 2:48 AM, Chris wrote: Hi All Have just upgraded to this version and am having the following issue. I use a the execute method on a ScopedSession to run generic SQL Statements in a TextClause, in the resulting BufferedRowResultProxy object their

Re: [sqlalchemy] integer fields return long python type on query

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 5:12 AM, Simone Orsi wrote: Hi all, I have a lot of integer fields in a mysql db and when I query them I get always a long python type instead of an integer python type. Is quite annoying to convert long to int every time... how can I get rid of this? I remember

Re: [sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 8:36 AM, Kent wrote: I've researched this in the past and they don't. I will look into re-introducing allow_null_pks as a new flag allow_partial_pks, defaults to True, will be honored by merge(), you set yours to False. this is 0.6 only. Thanks for your

[sqlalchemy] How to order_by relation by another join?

2010-02-10 Thread Andrija Zarić
Let's say I've got simple structure Order--Item--Detail. class Detail(Base): ... class Order(Base): ... class Item(Base): ... detail = relation(Detail, uselist=False, lazy=False) order = relation(Order, uselist=False, backref='items') Of course I can specify order_by for Order.items

Re: [sqlalchemy] How to order_by relation by another join?

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 10:17 AM, Andrija Zarić wrote: Let's say I've got simple structure Order--Item--Detail. class Detail(Base): ... class Order(Base): ... class Item(Base): ... detail = relation(Detail, uselist=False, lazy=False) order = relation(Order, uselist=False,

Re: [sqlalchemy] creating views declarative base is confusing

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 5:35 AM, anusha kadambala wrote: hello all, I want to create view based on the following tables from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey from sqlalchemy.ext.declarative import declarative_base

Re: [sqlalchemy] How to order_by relation by another join?

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 10:34 AM, Michael Bayer wrote: Maybe, I haven't tried this, you could make an alternate (non primary) mapping to Item that was a join of Item and Detail, i.e. like: itemdetail = mapper(Item.__table__.join(Detail.__table__), non_primary=True) Order.items =

[sqlalchemy] is sqlalchemy designed to work with gc turned on only ?

2010-02-10 Thread redfox
I`m interesting in one question (I didn`t find answer in docs): Is sqlalchemy designed to work with gc turned on only or not (in other words: Does the sqlalchemy free unused objects itself if gc turned off or not) ? -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] is sqlalchemy designed to work with gc turned on only ?

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 11:12 AM, redfox wrote: I`m interesting in one question (I didn`t find answer in docs): Is sqlalchemy designed to work with gc turned on only or not (in other words: Does the sqlalchemy free unused objects itself if gc turned off or not) ? All Python libraries I am

[sqlalchemy] bug in sqllite dialect?

2010-02-10 Thread Chris Withers
Hi All, With SA 0.5.8 on Python 2.5, the attached test_with_default blows up with: Traceback (most recent call last): File test_default_arg_sqlite.py, line 46, in test_with_default peterb2 = session.query(PersonWITH).filter_by(name='PeterB').first() File

Re: [sqlalchemy] bug in sqllite dialect?

2010-02-10 Thread Michael Bayer
not sure if this is obvious, its the sqlite3.PARSE_DECLTYPES. The SQLite date types don't expect this to be turned on. That is a handy feature which I'm not sure was available in such a simple form when I first wrote against the pysqlite dialect in Python 2.3. A workaround is to use a

[sqlalchemy] pairing merged object with the original

2010-02-10 Thread Kent
After merge() returns, is there a way for me to pair each object in the returned merge_obj with the object it was created from? For example: merged_obj = session.merge(object) At the top level, it is trivial, merged_obj was created because of the instance object For single RelationProperties

[sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-10 Thread Jeff Peterson
First spin though, I get these errors/warnings: /home/zope/.buildout/eggs/SQLAlchemy-0.6-py2.5.egg/sqlalchemy/engine/reflection.py:40: SAWarning: Did not recognize type 'ROWID' of column 'objid' ret = fn(self, con, *args, **kw)

Re: [sqlalchemy] pairing merged object with the original

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 2:49 PM, Kent wrote: After merge() returns, is there a way for me to pair each object in the returned merge_obj with the object it was created from? For example: merged_obj = session.merge(object) At the top level, it is trivial, merged_obj was created because of the

[sqlalchemy] RE: Warnings take a really long time / NotImplementedError

2010-02-10 Thread Jeff Peterson
BTW, this is using 0.6 beta1 build 6743 on Grok, reflecting a view from an Oracle (10.2) 10g DB. -- Jeffrey D Peterson Webmaster Crary Industries, Inc. From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Jeff Peterson Sent: Wednesday, February 10, 2010 2:29 PM

Re: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 3:28 PM, Jeff Peterson wrote: First spin though, I get these errors/warnings: /home/zope/.buildout/eggs/SQLAlchemy-0.6-py2.5.egg/sqlalchemy/engine/reflection.py:40: SAWarning: Did not recognize type 'ROWID' of column 'objid' ret = fn(self, con, *args, **kw)

[sqlalchemy] Re: pairing merged object with the original

2010-02-10 Thread Kent
If I understand you correctly, you are saying object.list[0] will always cause creation (or fetch) of merged.list[0] object.list[1] will always cause creation (or fetch) of merged.list[1] etc. There may be also more merged.list[2], [3], etc... Correct? This is the merge code 0.5.8: if

[sqlalchemy] Re: Problems with 0.6beta1

2010-02-10 Thread Chris
Thanks On 10 Feb, 14:55, Michael Bayer mike...@zzzcomputing.com wrote: restored in r6742. On Feb 10, 2010, at 2:48 AM, Chris wrote: Hi All Have just upgraded to this version and am having the following issue. I use a the execute method on a ScopedSession to run generic SQL

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-10 Thread Jeff Peterson
-- Jeffrey D Peterson Webmaster Crary Industries, Inc. From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer Sent: Wednesday, February 10, 2010 2:38 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Warnings take a really long time /

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-10 Thread Jeff Peterson
From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer Sent: Wednesday, February 10, 2010 2:38 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Warnings take a really long time / NotImplementedError On Feb 10, 2010, at 3:28 PM, Jeff

Re: [sqlalchemy] Re: pairing merged object with the original

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 3:52 PM, Kent wrote: If I understand you correctly, you are saying object.list[0] will always cause creation (or fetch) of merged.list[0] object.list[1] will always cause creation (or fetch) of merged.list[1] etc. There may be also more merged.list[2], [3], etc...

Re: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 4:13 PM, Jeff Peterson wrote: The first time I render that view, the reflection takes place and it takes the 30-40 seconds to load the page (during which time the warnings are being generated), once it’s mapped it is very fast. You should probably have reflection

[sqlalchemy] Re: pairing merged object with the original

2010-02-10 Thread Kent
Very good, thanks. Although, I'm pretty sure I understand what you are saying, what exactly do you mean by pending/transients? On Feb 10, 4:13 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 10, 2010, at 3:52 PM, Kent wrote: If I understand you correctly, you are saying

[sqlalchemy] Re: pairing merged object with the original

2010-02-10 Thread Kent
Further, if I inspect the returned object *directly* after the call to merge(), then aren't I guaranteed any Relations with use_list=True have will have the same length, since that is the point of merge in the first place? That being the case, I can always simply correspond the merged index with

[sqlalchemy] Collation and Column()

2010-02-10 Thread Christoph Burgmer
Having collations on a per-column basis in MySQL and SQLite, I'd like to specify the collation when creating tables/views. I have been trying google and source for some hours now, and it seems there's just no way to handle it easily with SA. MySQL has support via private VARCHAR, but SQLite has

[sqlalchemy] simplest pattern to query a database

2010-02-10 Thread Tarek Ziadé
Hi, I am using this pattern to execute a simple query on a database: def execute(sqluri, query): engine = create_engine(sqluri) connection = engine.connect() try: connection.execute(query) finally: connection.close() I was wondering if this was the best pattern,

RE: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-10 Thread Jeff Peterson
-- Jeffrey D Peterson Webmaster Crary Industries, Inc. From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer Sent: Wednesday, February 10, 2010 3:18 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Warnings take a really long time /

[sqlalchemy] Warning: Incorrect datetime value

2010-02-10 Thread Bobby Impollonia
I am constructing queries involving MSTimeStamp fields in MySQL and am being receiving Incorrect datetime value warnings even in situations where my queries are valid in MySQL. How do I modify the following query so that sqlalchemy will accept it without warning:

Re: [sqlalchemy] Re: pairing merged object with the original

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 4:28 PM, Kent wrote: Very good, thanks. Although, I'm pretty sure I understand what you are saying, what exactly do you mean by pending/transients? see the description here: http://www.sqlalchemy.org/docs/session.html#quickie-intro-to-object-states On Feb 10,

[sqlalchemy] Warning: Incorrect datetime value

2010-02-10 Thread Bobby Impollonia
I am constructing queries involving MSTimeStamp fields in MySQL and am being receiving Incorrect datetime value warnings even in situations where my queries are valid in MySQL. How do I modify the following query so that sqlalchemy will accept it without warning:

Re: [sqlalchemy] Re: pairing merged object with the original

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 4:36 PM, Kent wrote: Further, if I inspect the returned object *directly* after the call to merge(), then aren't I guaranteed any Relations with use_list=True have will have the same length, since that is the point of merge in the first place? you can assume the lengths

[sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Kent
When I do something simple like this script: o=Order() o.orderid = 'KBORDE' ol=OrderDetail() ol.lineid=1 # exists in database o.orderdetails=[ol] mo=DBSession.merge(o) mo.orderdetails[0] in DBSession.new mo.orderdetails[0].saleprice = 65 DBSession.flush() (output pasted below)= I

[sqlalchemy] Re: pairing merged object with the original

2010-02-10 Thread Kent
On Feb 10, 6:59 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 10, 2010, at 4:36 PM, Kent wrote: Further, if I inspect the returned object *directly* after the call to merge(), then aren't I guaranteed any Relations with use_list=True have will have the same length, since that

Re: [sqlalchemy] Warnings take a really long time / NotImplementedError

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 6:05 PM, Jeff Peterson wrote: It’s touching a ton of tables, hundreds…if I had to guess I’d say every table in the schema. The reasons for this are unknown to me, certainly all those tables are not related specifically to the single view I am attempting to reflect.

Re: [sqlalchemy] Collation and Column()

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 5:04 PM, Christoph Burgmer wrote: Having collations on a per-column basis in MySQL and SQLite, I'd like to specify the collation when creating tables/views. I have been trying google and source for some hours now, and it seems there's just no way to handle it easily with

Re: [sqlalchemy] simplest pattern to query a database

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 5:24 PM, Tarek Ziadé wrote: Hi, I am using this pattern to execute a simple query on a database: def execute(sqluri, query): engine = create_engine(sqluri) connection = engine.connect() try: connection.execute(query) finally:

Re: [sqlalchemy] Warning: Incorrect datetime value

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 6:52 PM, Bobby Impollonia wrote: I am constructing queries involving MSTimeStamp fields in MySQL and am being receiving Incorrect datetime value warnings even in situations where my queries are valid in MySQL. How do I modify the following query so that sqlalchemy will

[sqlalchemy] backref questions

2010-02-10 Thread David Ressman
Hello, First of all, I'll apologize if this is a really basic question. I've not been using SQLAlchemy for long, and I've only very recently picked up Python. Even though I've looked everywhere I can think of for an answer to this question, I'm almost certain that it is not a difficult one.

Re: [sqlalchemy] backref questions

2010-02-10 Thread Michael Trier
Hi, On Feb 10, 2010, at 6:54 PM, David Ressman wrote: Hello, First of all, I'll apologize if this is a really basic question. I've not been using SQLAlchemy for long, and I've only very recently picked up Python. Even though I've looked everywhere I can think of for an answer to this

Re: [sqlalchemy] backref questions

2010-02-10 Thread David Ressman
On Feb 10, 2010, at 7:38 PM, Michael Trier wrote: What you likely want to dig into is Query enabled properties (http://www.sqlalchemy.org/docs/mappers.html?highlight=property%20association#building-query-enabled-properties). I used this a lot of times to tie what appears to be a relationship

Re: [sqlalchemy] Re: SQLAlchemy goes back to database when I wouldn't expect it to...

2010-02-10 Thread Michael Bayer
On Feb 10, 2010, at 7:10 PM, Kent wrote: When I do something simple like this script: o=Order() o.orderid = 'KBORDE' ol=OrderDetail() ol.lineid=1 # exists in database o.orderdetails=[ol] mo=DBSession.merge(o) mo.orderdetails[0] in DBSession.new mo.orderdetails[0].saleprice = 65

[sqlalchemy] correlate on Query in 0.4

2010-02-10 Thread Kalium
Hi, 0.4 doesn't seem to support correlate() on a Query object. I have a subquery (which is actually just another Query object), so at no point can I actually do a correlate(). Any other good options other than upgrading to 0.5 or using a select ? Cheers -- You received this message because you