Re: [sqlalchemy] mapper on a temporary class

2021-01-27 Thread Kent Bower
Excellent. As always, thanks very much for your time and answers (let alone awesome software)! On Wed, Jan 27, 2021 at 1:25 PM Mike Bayer wrote: > > > On Tue, Jan 26, 2021, at 9:01 PM, Kent Bower wrote: > > Thanks a ton for your responses. > > Do all the normal column

Re: [sqlalchemy] mapper on a temporary class

2021-01-26 Thread Kent Bower
uld that modify the compiled mappers for the entire process... these are the things running through my head.) On Tue, Jan 26, 2021 at 8:18 PM Mike Bayer wrote: > > > On Tue, Jan 26, 2021, at 7:31 PM, Kent Bower wrote: > > I should have given these details from the get

Re: [sqlalchemy] mapper on a temporary class

2021-01-26 Thread Kent Bower
I should have given these details from the get-go: the use case is a specialized select() (dynamically built) which would be extremely convenient to map relationships against for convenience in subquery loading, etc. So, the class would not already have a mapper. Can I pass non_primary=True

Re: [sqlalchemy] connection close() questions

2020-05-14 Thread Kent Bower
ore > warnings or conditions like this. the most important part is getting the > test coverage in so as I refactor for 1.4 / 2.0 the behavioral contract is > maintained. thanks! > > > > On Wed, May 13, 2020, at 1:16 PM, Kent Bower wrote: > > Very good, will do when I find tim

Re: [sqlalchemy] connection close() questions

2020-05-13 Thread Kent Bower
ts > screwed up, the pool will warn and still make sure it does a real > rollback.you should not see this warning however. > > in 2.0, the whole "reset" logic is simplified so that none of this > complexity will be there. > > > > On Wed, May 13, 2020, at 11:5

Re: [sqlalchemy] connection close() questions

2020-05-13 Thread Kent Bower
elease today > > > > On Wed, May 13, 2020, at 11:51 AM, Mike Bayer wrote: > > > > On Wed, May 13, 2020, at 11:39 AM, Kent Bower wrote: > > In this script, conn.close() does *not *call rollback on the > transaction. It isn't just a logging issue as I've verified from the &g

Re: [sqlalchemy] connection close() questions

2020-05-13 Thread Kent Bower
In this script, conn.close() does *not *call rollback on the transaction. It isn't just a logging issue as I've verified from the database that the session was not rolled back. On Wed, May 13, 2020 at 11:31 AM Mike Bayer wrote: > Haven't looked deeply but so far what you need to know is that >

Re: [sqlalchemy] Re: deferred column_properties should probably not be expired unless they were already loaded

2017-05-10 Thread Kent Bower
Thanks very much! On Wed, May 10, 2017 at 2:24 PM, mike bayer wrote: > this is all patched in 1.2, your original test works too. > > The fix here is a little too intricate for 1.1 right now as this is a very > long-standing bug(goes back to 0.7 at least and

Re: [sqlalchemy] Re: deferred column_properties should probably not be expired unless they were already loaded

2017-05-10 Thread Kent Bower
If never present in __dict__, why does it need to be marked as expired after an insert or update? If not in __dict__ and referenced, isn't won't it load as whether or not it is marked as expired? On Wed, May 10, 2017 at 1:48 PM, mike bayer wrote: > nevermind, the

Re: [sqlalchemy] Re: deferred column_properties should probably not be expired unless they were already loaded

2017-05-10 Thread Kent Bower
The regular columns seem to expire and reload properly without issue. (Is that what you're asking?) You want me to submit a PR changing: if p.expire_on_flush or p.key *not *in state.dict to if p.expire_on_flush *and *p.key in state.dict ? On Wed, May 10, 2017 at 12:55 PM, mike bayer

Re: [sqlalchemy] inspect a scalar relationship property when it is loaded

2016-10-28 Thread Kent Bower
The load() event would also capture if it were subqueryload()ed, right? And overriding Query.__iter__ wouldn't catch the cases where the scalar is a "use_get" lookup that was already in session.identity_map... No good way to intercept attributes.set_committed() for that, is there? On Fri, Oct

Re: [sqlalchemy] suppress echo of INSERT/UPDATE large binary data

2016-08-18 Thread Kent Bower
I attempted to search for such an enhancement but obviously failed to find it. Patching the changeset in was fairly straightforward. Thanks very much Jonathan and Mike!! On Wed, Aug 17, 2016 at 5:41 PM, Mike Bayer wrote: > > > On 08/17/2016 01:25 PM, Kent wrote: >

Re: [sqlalchemy] Help with a custom "seconds_interval()" construct

2016-05-31 Thread Kent Bower
Thanks Mike. I'm not sure FunctionElement is most appropriate or if Interval() is the best "type," but for future readers, as a recipe, this seems to work: class seconds_interval(FunctionElement): type = Interval() name = 'seconds' def __init__(self, *args, **kwargs):

Re: [sqlalchemy] Guaranteeing same connection for scoped session

2016-04-14 Thread Kent Bower
Yeah, it seems to me that if you pass a *specific connection* to a sessionmaker for some (whatever) reason, that sessionmaker shouldn't ever silently take a different one. I'll need to work on detecting or sabotaging new connections from a sessionmaker which was passed a specific connection. (I

Re: [sqlalchemy] Guaranteeing same connection for scoped session

2016-04-13 Thread Kent Bower
ah either don't > call that , or set up the connection immediately on the next session. > > On Wednesday, April 13, 2016, Kent Bower <k...@bowermail.net > <javascript:_e(%7B%7D,'cvml','k...@bowermail.net');>> wrote: > >> About a year ago you helped me ensure my

Re: [sqlalchemy] Guaranteeing same connection for scoped session

2016-04-13 Thread Kent Bower
About a year ago you helped me ensure my scoped session gets the same connection to the database, which might be important. I found out using "bind=connection" doesn't guarantee the session_maker uses that connection if something went wrong with the session and ScopedSession.remove() was called.

Re: [sqlalchemy] Undefer Hybrid Attributes

2013-03-07 Thread Kent Bower
That makes sense, Thanks, Kent On Mar 7, 2013, at 12:09 PM, Michael Bayer mike...@zzzcomputing.com wrote: The hybrid attribute is a Python function that invokes when it's called. So it doesn't make sense for it to be a column property since there is no attribute to be populated.

Re: [sqlalchemy] Apparently redundant subqueryloads with single table inheritance

2012-06-05 Thread Kent Bower
Thank you! On 6/5/2012 4:41 PM, Michael Bayer wrote: On Jun 5, 2012, at 4:21 PM, Kent wrote: I am subquery loading some related properties for a polymorphic inheritance use case similar to the script attached. SQLA seems to be issuing several extra queries that I didn't expect and don't

Re: [sqlalchemy] sqlalchemy supports INSERT INTO ... (SELECT .. ) ?

2012-03-30 Thread Kent Bower
Thanks for pointing me there. As an aside, the recipe would be more bulletproof if it specified the columns (order). Currently, it assumes sqlalchemy knows the order of the columns in the database, which it may not. Thanks again! On 3/30/2012 6:40 PM, Michael Bayer wrote: its not built in

Re: [sqlalchemy] sqlalchemy supports INSERT INTO ... (SELECT .. ) ?

2012-03-30 Thread Kent Bower
')) or something like that. Maybe people have suggestions. On Mar 30, 2012, at 6:43 PM, Kent Bower wrote: Thanks for pointing me there. As an aside, the recipe would be more bulletproof if it specified the columns (order). Currently, it assumes sqlalchemy knows the order of the columns in the database

Re: [sqlalchemy] Single table inheritance

2012-03-21 Thread Kent Bower
That will work for me, thanks! P.S. make a note that the doc statement that it will be a future release should be updated. On 3/21/2012 10:04 AM, Michael Bayer wrote: also polymorphic_on can be any SQL expression in 0.7, like a CASE statement if you wanted. -- You received this message

Re: [sqlalchemy] Half merge/save cascade support for M:N relationships

2012-02-29 Thread Kent Bower
I hadn't really thought the save-update through, my real interest was regarding merge. For save-update it may not make as much sense. On 2/29/2012 10:55 AM, Michael Bayer wrote: I get what that would do for merge and might not be a big deal, what would it do for save-update? Sent from my

[sqlalchemy] expunge cascade behavior change

2012-01-31 Thread Kent Bower
Somewhere between 0.6.4 and 0.7.5, the expunge cascade behavior changed. Can you help me understand what changed/point me to the ticket? The attached script assertions succeed in 0.6.4 but the last one fails in 0.7.5. It doesn't seem wrong, but I'm wondering what the behavior was defined as

[sqlalchemy] session.query().get() is unsupported during flush for getting an object that was just added?

2012-01-26 Thread Kent Bower
I think I understand why, during a flush(), if I use session.query().get() for an item that was just added during this flush, I don't get the persistent object I might expect because the session still has it as pending even though, logically, it is already persistent. I don't suppose you have

Re: [sqlalchemy] c extensions built?

2012-01-12 Thread Kent Bower
Yeah, just the two cresultproxy.so and cprocessors.so, right? On 1/12/2012 3:34 PM, Michael Bayer wrote: when you do the setup.py the log messages say so. Otherwise you'd look where sqlalchemy was installed and check if you see .so files. On Jan 12, 2012, at 12:35 PM, Kent wrote: What is

Re: [sqlalchemy] Re: 0.7 event migration

2012-01-10 Thread Kent Bower
funny story, here's where it was added: http://www.sqlalchemy.org/trac/ticket/1910 which is essentially your ticket ! :) I just double checked and I had patched in rfde41d0e9f70 http://www.sqlalchemy.org/trac/changeset/fde41d0e9f70/. Is there another commit that went against 1910? For

Re: [sqlalchemy] Re: 0.7 event migration

2012-01-10 Thread Kent Bower
Thank you very much! On 1/10/2012 11:47 AM, Michael Bayer wrote: Code wasn't covered and is a regresssion, fixed in rd6e321dc120d. On Jan 10, 2012, at 10:58 AM, Kent wrote: Mike, Old code: == def visit_bindparam(bindparam):

Re: [sqlalchemy] Re: 0.7 event migration

2012-01-09 Thread Kent Bower
On 1/9/2012 2:33 PM, Michael Bayer wrote: On Jan 9, 2012, at 2:30 PM, Kent wrote: i guess the patch is interacting with that load_on_pending stuff, which I probably added for you also. It would be nice to really work up a new SQLAlchemy feature: detached/transientobject loading document

Re: [sqlalchemy] Re: 0.7 event migration

2012-01-09 Thread Kent Bower
On 1/9/2012 5:33 PM, Michael Bayer wrote: On Jan 9, 2012, at 2:36 PM, Kent Bower wrote: that means some of the columns being linked to the foreign keys on the target are None. If you want your lazyload to work all the attributes need to be populated. If you're hitting the get committed

Re: [sqlalchemy] 0.7 event migration

2011-12-24 Thread Kent Bower
Right. And reconstruct_instance() was renamed load()? On 12/24/2011 5:56 PM, Michael Bayer wrote: On Dec 24, 2011, at 10:04 AM, Kent wrote: As the migration guide suggests, I'd like to embrace the events API. Is mapper event load() invoked at exactly the same place as the deprecated

Re: [sqlalchemy] Interpretation of SAWarning: No ForeignKey objects were present in secondary table 'post_keywords'...

2011-04-19 Thread Kent Bower
So, what would you suggest the right answer is in this case? In the real world scenario we have a potentially good reason to avoid the association proxy approach since that involves an additional table which may be unneeded. Is the best answer just to provide the foreign keys as I did? On

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent Bower
If I intercept strings that are empty and replace with None, is there potential problems because the database record and the python object are out of sync? Thereafter, will sqla believe the column value has changed and try to write again on next flush()? On 11/4/2010 11:42 AM, Michael

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent Bower
is None you get False. But if you expire the attribute and then ask again you get True. On 11/4/2010 5:07 PM, Michael Bayer wrote: On Nov 4, 2010, at 4:06 PM, Kent Bower wrote: If I intercept strings that are empty and replace with None, is there potential problems because the database record

Re: [sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent Bower
P.S. Thanks again very much -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options,

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-10 Thread Kent Bower
to make that change..., but let me know. On 9/8/2010 3:34 PM, Kent Bower wrote: I've got a recipe for what will work well for us. I imagine it could be useful for others, although I left out the actual serialization mechanism, since that will likely be very project specific. I'd be happy

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-10 Thread Kent Bower
I've got a fix for our project. Python is really cool about letting you reassign methods and functions, so I just reassigned CollectionAttributeImpl._set_iterable to my own function. The point is, for my sake, don't worry about a public API, unless others also ask about it... Thanks for

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-10 Thread Kent Bower
on it. I just know that as default behavior, or even readily switchable behavior, non-invested users get confused rather quickly. On Sep 10, 2010, at 4:21 PM, Kent Bower wrote: I've got a fix for our project. Python is really cool about letting you reassign methods and functions, so I just

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-08 Thread Kent Bower
) On 9/8/2010 1:27 PM, Michael Bayer wrote: On Sep 8, 2010, at 1:15 PM, Kent Bower wrote: I imagine you are already aware of this... Unfortunately, the clause comparison says these two clauses are different: (Pdb) print self locations.siteid = :param_1 AND locations.locationid = :param_2

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-08 Thread Kent Bower
than welcome (I'd prefer your feedback). If you are busy, I can just post it and hope someone may find it useful. Thank again for your help, Kent On 9/7/2010 7:28 PM, Michael Bayer wrote: On Sep 7, 2010, at 6:41 PM, Kent Bower wrote: Two items: * How does the orm currently determine whether

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-07 Thread Kent Bower
Mike, in your proof of concept, when __getstate__ detected transient, why did you need to make a copy of self.__dict__? self.__dict__.copy() On 9/6/2010 2:35 PM, Michael Bayer wrote: On Sep 6, 2010, at 2:11 PM, Kent Bower wrote: Also, I was hoping you would tell me whether this would

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-07 Thread Kent Bower
/7/2010 10:25 AM, Michael Bayer wrote: On Sep 7, 2010, at 10:12 AM, Kent Bower wrote: Mike, in your proof of concept, when __getstate__ detected transient, why did you need to make a copy of self.__dict__? self.__dict__.copy() i was modifying the __dict__ from what would be expected in a non

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-06 Thread Kent Bower
Fantastic, I will like to look into this change. Since you asked, consider a use case similar to this: we have a RESTfulish web service that accepts a serialized version of a transfer object which is passed to the server when a database save should take place. In this case, an order with

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-06 Thread Kent Bower
On Sep 6, 2010, at 1:04 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 6, 2010, at 12:01 PM, Kent Bower wrote: Fantastic, I will like to look into this change. Since you asked, consider a use case similar to this: we have a RESTfulish web service that accepts a serialized

Re: [sqlalchemy] Re: Loading attributes for Transient objects

2010-09-06 Thread Kent Bower
or pickling it... the server is stateless. Would that make a difference to your approach? On 9/6/2010 2:35 PM, Michael Bayer wrote: On Sep 6, 2010, at 2:11 PM, Kent Bower wrote: Also, I was hoping you would tell me whether this would be a candidate for subclassing InstrumentedAttribute

Re: [sqlalchemy] conditional joins/relationships

2010-08-20 Thread Kent Bower
Now, thank you for the quick reply. I might not be understanding what you need here, but assuming you want your API to look like this: product.sales('2010-08-20') [Sale,Sale, ...] Right, that is the idea. First of all, is that enough? If you just want to dynamically access an

Re: [sqlalchemy] SqlAlchemy logging FAQ

2010-08-18 Thread Kent Bower
Ah. Then the problem is in turbogears (which creates a default .ini file with): #echo shouldn't be used together with the logging module. sqlalchemy.echo = false sqlalchemy.echo_pool = false sqlalchemy.pool_recycle = 3600 ...logging sections...

Re: [sqlalchemy] Oracle 8i supports RETURNING clause (but sqla running 8i doesn't)

2010-08-16 Thread Kent Bower
I did find a reference for oracle 8.0 that supports returning clause... I've moved this to a ticket request in trac: http://www.sqlalchemy.org/trac/ticket/1878 On 8/14/2010 11:14 AM, Kent Bower wrote: Not a myth, I'm using them (via sqla). Simple views (just one table) oracle figures out

Re: [sqlalchemy] Oracle 8i supports RETURNING clause (but sqla running 8i doesn't)

2010-08-14 Thread Kent Bower
Not a myth, I'm using them (via sqla). Simple views (just one table) oracle figures out writes to all alone. For more complex views (joins of tables), you can use an INSTEAD OF trigger to write to the view (just pl/sql trigger where you tell Oracle what you want to happen when someone

Re: [sqlalchemy] Merge support with ConcreteInheritedProperty

2010-08-02 Thread Kent Bower
Excellent. The 'pass' ConcreteInheritedProperty.merge() method works fine. Thanks again. On 8/1/2010 2:24 PM, Michael Bayer wrote: On Jul 31, 2010, at 7:41 AM, Kent wrote: When I call merge() on an ArTran object, the merge() method of a ConcreteInheritedProperty 'artransarchiveid' that

Re: [sqlalchemy] Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent Bower
No, in fact, there is no ArTranBase table at all. If I remove concrete inheritance, how do I issue a UNION of the two tables and have the objects polymorphically loaded? On 7/29/2010 4:18 PM, Michael Bayer wrote: On Jul 29, 2010, at 2:31 PM, Kent wrote: I'm getting a messy error that

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent Bower
Right. I understand. Thanks for pointing that out, you are correct. My bigger concern was getting the ArTranBase mapper correct. Apparently there is no need in this case to specify with_polymorphic= in the mapper. Did I miss documentation on using 'polymorphic_union' without

Re: [sqlalchemy] EXISTS statements with any(), but with a join

2010-06-04 Thread Kent Bower
Nice. That might come in very useful, thanks. However, I can't quite get the second approach to work: exq=DBSession.query(Inventory).join(Location).filter(Location.siteid=='03').correlate(Product).subquery() DBSession.query(Product).filter(exists(exq)).all() Traceback (most recent call last):

Re: [sqlalchemy] Re: For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-31 Thread Kent Bower
On 5/30/2010 1:24 PM, Michael Bayer wrote: On May 28, 2010, at 1:46 PM, Kent Bower wrote: On 5/28/2010 10:08 AM, Michael Bayer wrote: Is the pattern that you want to keep re-issuing a savepoint repeatedly using the same name ? Does that have some different usage of resources versus

Re: [sqlalchemy] Re: For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-31 Thread Kent Bower
On 5/31/2010 9:55 AM, Michael Bayer wrote: On May 31, 2010, at 8:24 AM, Kent Bower wrote: Although sqla doesn't allow the user to specify the savepoint name, the same could be accomplished given if support for the following were implemented: Let me ask: sp_a=begin_nested

Re: [sqlalchemy] Re: For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-28 Thread Kent Bower
* Is there a way besides session.commit() to free the savepoint resource? Is there a way to provide the savepoint name, so I can use the same name over? Lastly, if you aren't the expert, where would you point me, zope group or TG group? you could issue the SAVEPOINT instructions

Re: [sqlalchemy] Re: For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-28 Thread Kent Bower
From a quick reading of the 'transaction' package source, it looks like you should be able to create savepoints and roll them back something like this: savepoint = transaction.savepoint() try: # ... except: savepoint.rollback() raise Thanks for the interest in helping. I

Re: [sqlalchemy] Re: For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-28 Thread Kent Bower
On 5/28/2010 10:08 AM, Michael Bayer wrote: Is the pattern that you want to keep re-issuing a savepoint repeatedly using the same name ? Does that have some different usage of resources versus issuing/closing distinct savepoints with different names ? As an aside, since oracle apparently has

Re: [sqlalchemy] For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-27 Thread Kent Bower
Thank you, as always. I failed to recognize I'm using the TurboGears foundation, which uses zope transaction: Is there a way to still accomplish this? DBSession.begin_nested() sqlalchemy.orm.session.SessionTransaction object at 0xe9d5150 DBSession.commit() Traceback (most recent call

Re: [sqlalchemy] Re: sqla 0.6.0 with oracle 8 (ORA-00907: missing right parenthesis)

2010-05-18 Thread Kent Bower
No, this is what was causing ORA-12704: character set mismatch: SQL SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM DUAL; SELECT CAST('test unicode returns' AS NVARCHAR2(60)) AS anon_1 FROM DUAL * ERROR at line 1: ORA-12704: character set mismatch On

Re: [sqlalchemy] Re: is sqlalchemy-migrate the right way to go?

2010-05-17 Thread Kent Bower
Thanks, that looks like its conceptually what we are hoping for, at least. On 5/17/2010 3:58 PM, Tamás Bajusz wrote: On Mon, May 17, 2010 at 9:49 PM, Kentk...@retailarchitects.com wrote: Ideally, I agree. Practically speaking, though, we came from a company where dozens and dozens of

Re: [sqlalchemy] allow_partial_pks=False goes to database on partial pk

2010-05-11 Thread Kent Bower
http://www.sqlalchemy.org/trac/ticket/1797 On 5/11/2010 9:50 AM, Michael Bayer wrote: just put up a new ticket, i dont really have time to attend to these right now. you're right we'd probably move the partial pk's check to the ultimate call that un-expires things. On May 10, 2010, at

[sqlalchemy] Re: [Distutils] inability to pass setup.py command line arguments to dependency setups

2010-05-07 Thread Kent Bower
Just because there are configuration problems associated with adding a feature like the one I needed is absolutely no reason to abandon it when it can bring value to the tool if used correctly and in some circumstances. I considered some of those exact complications what if it was already

[sqlalchemy] Numeric not consistent between Postgres and Oracle in 0.6

2010-05-06 Thread Kent Bower
The following has changed since 0.5.8 in 0.6.0. I believe this is already known or by design from reading docs and another post but want to point out. If you specify a column such as this: Column(saleprice, Numeric, nullable=False) you get a 'numeric' type in PostgreSQL, which supports

Re: [sqlalchemy] disable RETURNING for specific primary key columns

2010-05-04 Thread Kent Bower
You think of everything? ;) Thanks On 5/4/2010 2:41 PM, Michael Bayer wrote: On May 4, 2010, at 2:30 PM, Kent wrote: I understand I can disable RETURNING for an engine with 'implicit_returning=False' Is there a way to do this for certain primary key columns only, but not disabled

Re: [sqlalchemy] SQL compilation broken in 0.6 for Oracle use_ansi=False

2010-05-03 Thread Kent Bower
Note that this was ok in 0.5.8, so it must have been something related to 0.6... On 5/3/2010 12:04 PM, Michael Bayer wrote: You can file a ticket for this but note that not everything is possible with use_ansi=False. that mode of operation is somewhat miraculous that it even exists. this

Re: [sqlalchemy] SQL compilation broken in 0.6 for Oracle use_ansi=False

2010-05-03 Thread Kent Bower
Thank you, sir. On May 3, 2010, at 7:33 PM, Michael Bayer mike...@zzzcomputing.com wrote: OK the issue here is entirely un-subtle and its a little weird that none of the tests we have hit upon it. this is fixed in tip. On May 3, 2010, at 12:06 PM, Kent Bower wrote: Note

Re: [sqlalchemy] upgrade to SQLA 0.6

2010-05-01 Thread Kent Bower
May help others: instead of col in const.columns I needed col in list(const.columns) to avoid: sqlalchemy.exc.ArgumentError: __contains__ requires a string argument with the ColumnCollection object On 4/30/2010 4:16 PM, Michael Bayer wrote: Kent wrote: I did read 0.6 Migration

Re: [sqlalchemy] upgrade to SQLA 0.6

2010-05-01 Thread Kent Bower
Wait a second... ForeignKeyConstraint doesn't but PrimaryKeyConstraint does? (Not trying to be sassy, just wondering why I got the error in the first place) On 5/1/2010 2:11 PM, Michael Bayer wrote: On May 1, 2010, at 2:04 PM, Kent Bower wrote: May help others: instead of col

Re: [sqlalchemy] upgrade to SQLA 0.6

2010-05-01 Thread Kent Bower
Oh, I get it, you are saying ColumnCollection has contains_column() method. On 5/1/2010 4:05 PM, Kent Bower wrote: Wait a second... ForeignKeyConstraint doesn't but PrimaryKeyConstraint does? (Not trying to be sassy, just wondering why I got the error in the first place) On 5/1/2010 2

Re: [sqlalchemy] upgrade to SQLA 0.6

2010-05-01 Thread Kent Bower
): = On 5/1/2010 4:06 PM, Kent Bower wrote: Oh, I get it, you are saying ColumnCollection has contains_column() method. On 5/1/2010 4:05 PM, Kent Bower wrote: Wait a second... ForeignKeyConstraint doesn't but PrimaryKeyConstraint does? (Not trying to be sassy, just wondering why I got the error

Re: [sqlalchemy] Re: making a transient copy of instances recursively at merge() time

2010-04-30 Thread Kent Bower
it up in a separate session and then merge it into my main session? Then, after that, merge the transient objects into my main session? Would that get me closer? Ideally, I wouldn't want it to need 2 trips to the database. On 4/29/2010 4:48 PM, Michael Bayer wrote: Kent Bower wrote

Re: [sqlalchemy] Re: making a transient copy of instances recursively at merge() time

2010-04-30 Thread Kent Bower
On 4/30/2010 11:17 AM, Michael Bayer wrote: Kent Bower wrote: Could I look it up in a separate session and then merge it into my main session? Then, after that, merge the transient objects into my main session? Would that get me closer? Ideally, I wouldn't want it to need 2 trips

Re: [sqlalchemy] Re: making a transient copy of instances recursively at merge() time

2010-04-29 Thread Kent Bower
I'm exactly trying to avoid adding esoteric hacks - (why I posted in the first place), so thanks for the information. I'll look into the examples you've provided; I'm hopeful that the versioned objects have in-tact relations (such that I could say old_object.orderdetails and get that

Re: [sqlalchemy] Re: making a transient copy of instances recursively at merge() time

2010-04-29 Thread Kent Bower
It is helpful to know what SQLA was designed for. Also, you may be interested to know of our project as we are apparently stretching SQLA's use case/design. We are implementing a RESTful web app (using TurboGears) on an already existent legacy database. Since our webservice calls (and

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent Bower
Thanks very much. On 4/2/2010 5:41 PM, Michael Bayer wrote: Kent wrote: Along the same lines, is there something we can do about nvl() (oracle) versus coalesce() (ansi)? They aren't exactly the same, unfortunately (nvl takes exactly 2 arguments, no more), so maybe there is nothing

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent Bower
As an aside, more recent Oracles support ansi coalesce, so it is probably more appropriate to only use nvl() for older, non-ansi Oracle versions, but if this is only for illustration then that is not a big deal (unless you don't want people writing to you saying coalesce does support more than

Re: [sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent Bower
By the way, Unless a ClauseList is subscriptable in 0.6, I had problems the way it was. Here is what I did: @compiles(coalesce, 'oracle') def compile(element, compiler, **kw): sql = nvl(%s) clauses = map(compiler.process, element.clauses) for i in xrange(len(clauses) - 2):

Re: [sqlalchemy] Re: passing arguments to complicated columns

2010-04-01 Thread Kent Bower
Thanks for the info. Still wondering, is there a way to tell the orm (a join criterion or a binary expression) use this function to find the param for the bind? On Apr 1, 2010, at 6:11 PM, Michael Bayer mike...@zzzcomputing.com wrote: Kent wrote: I believe (correct me if you know

Re: [sqlalchemy] Sequences support for CYCLE and MIN/MAX values

2010-03-26 Thread Kent Bower
Thanks for the info. Since it is NOCYCLE in oracle and NO CYCLE in postgres, I would check the engine.dialect.name in the compile, method correct? if eng.dialect.name == 'oracle': sql += NOCYCLE elif eng.dialect.name ==

Re: [sqlalchemy] Session user data

2010-03-23 Thread Kent Bower
Excellent. Thank for the example. Questions: 1. I assume not, but want to ask: is there anything special about the attribute '_cache' you've added to the session object? I could add any such attribute? 2. Will this work fine with scoped sessions? (these objects aren't recycled are

Re: [sqlalchemy] Refresh() for update

2010-03-19 Thread Kent Bower
By the way, must get() always accept a primary key? For composite keys is there a shortcut to access its ident (in the correct order)? (So I could get the ident tuple and pass it to get() with populate_existing()) On Mar 19, 2010, at 1:12 PM, Michael Bayer mike...@zzzcomputing.com