[sqlalchemy] Re: 0.7 event migration

2011-12-26 Thread Kent
Bayer mike...@zzzcomputing.com wrote: On Dec 26, 2011, at 9:07 AM, Kent wrote: Documentation for AttributeImpl.callable_ still reads     optional function which generates a callable based on a parent           instance, which produces the default values for a scalar or           collection

[sqlalchemy] Re: 0.7 event migration

2011-12-26 Thread Kent
think I'll put: state.session_id = None in a finally block, but you get the idea On Dec 26, 1:50 pm, Kent jkentbo...@gmail.com wrote: Yes, a nice simplification. I'm using it to lazyload attributes for objects that aren't in a session.  I'm not sure if you pointed me there, I think I found

[sqlalchemy] 0.7 event migration

2011-12-24 Thread Kent
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 reconstruct_instance() ? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

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

[sqlalchemy] enable_eagerloads

2011-12-17 Thread Kent
Hate to bother again, but I've been down this road several times and even created a less than adequate solution but am determined to make this area more usable: Problem: I'd like to easily be able to specify to a query disable_other_eagerloads, in a manner similar to enable_eagerloads(False),

Re: [sqlalchemy] enable_eagerloads

2011-12-17 Thread Kent
On 12/17/2011 12:10 PM, Michael Bayer wrote: On Dec 17, 2011, at 11:32 AM, Kent wrote: Hate to bother again, but I've been down this road several times and even created a less than adequate solution but am determined to make this area more usable: Problem: I'd like to easily be able

Re: [sqlalchemy] enable_eagerloads

2011-12-17 Thread Kent
How do I get the attribute to copy to a subquery's query._attribute ? I need it to be a MapperOption and that should then copy itself via q = q._conditional_options(*orig_query._with_options)? (This doesn't seem like it needs be a MapperOption, or do you think it should be? Not quite sure

Re: [sqlalchemy] enable_eagerloads

2011-12-17 Thread Kent
(context.attributes[key]) # = else: return self.strategy def _get_strategy(self, cls): try: return self._strategies[cls] except KeyError: return self.__init_strategy(cls) On 12/17/2011 2:35 PM, Kent wrote: How do I get the attribute

[sqlalchemy] before_expunge or after_expunge

2011-12-15 Thread Kent
the database that I've already expunged. Do you understand where I am headed and can you think of a better mechanism to deal with what I'm trying to accomplish? Thanks! Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

Re: [sqlalchemy] before_expunge or after_expunge

2011-12-15 Thread Kent
On 12/15/2011 12:20 PM, Michael Bayer wrote: On Dec 15, 2011, at 11:46 AM, Kent wrote: I notice no such API events as before_expunge() or after_expunge(). Hopefully without taking much of your time, can you point me in any direction of how I might go about being notified when an object

Re: [sqlalchemy] before_expunge or after_expunge

2011-12-15 Thread Kent
On 12/15/2011 1:31 PM, Michael Bayer wrote: Are there reasons one need to avoid referencing unloaded relationships from within before_upate()? (I can't recall the exact problem I've had in the past with that at the moment.) Thanks for all the input. Regarding the issue of referencing a

[sqlalchemy] Re: before_expunge or after_expunge

2011-12-15 Thread Kent
On Dec 15, 2:39 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 15, 2011, at 2:13 PM, Kent wrote: On 12/15/2011 1:31 PM, Michael Bayer wrote: Are there reasons one need to avoid referencing unloaded relationships from within before_upate()?  (I can't recall the exact problem

Re: [sqlalchemy] Re: before_expunge or after_expunge

2011-12-15 Thread Kent
wait...that's where you lose me. In this condition where user's changed someobject.some_related_id, then as soon as that is flushed, someobject.some_related by definition is no longer going to be the object we get with the currently committed id This is circling back to the automatic

Re: [sqlalchemy] Re: before_expunge or after_expunge

2011-12-15 Thread Kent
On 12/15/2011 6:29 PM, Michael Bayer wrote: I never use before_update()/before_insert() for anything outside of direct SQL manipulation, which is what they are intended for. That's why they get a Connection but not a Session. So are you suggesting if I did this all within before_flush(),

[sqlalchemy] query.only_load_relationships() API

2011-11-03 Thread Kent
properties alone)? I've come across this several times now and I find it awkward to need to enumerate all the joined_loads and turn them off manually with query.options(lazyload()). Suggestions? Thanks, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Rationale for skipping autoflush if populate_existing

2011-10-25 Thread Kent
Mike, What is the rationale for making populate_existing() skip the autoflush? Thanks, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send

Re: [sqlalchemy] Rationale for skipping autoflush if populate_existing

2011-10-25 Thread Kent
before we knew how to expire things) I'd want it to autoflush first. But for now the change would be backwards incompatible with some hypothetical app that is using it and expects pending changes to be erased. On Oct 25, 2011, at 2:18 PM, Kent wrote: Mike, What is the rationale for making

[sqlalchemy] Re: Rationale for skipping autoflush if populate_existing

2011-10-25 Thread Kent
() except in tests. Can I safely assume sqla will never invoke query.populate_existing()? If so, my mod is safe. If not, back to the drawing board... On Oct 25, 2:58 pm, Kent jkentbo...@gmail.com wrote: I'm glad it's there... I need it when doing a refresh where I need to keep the current

[sqlalchemy] Re: attributes.get_history() seems inconsistent when changing from NULL versus to NULL

2011-09-26 Thread Kent
upon being able to mutate metadata... sqlalchemy works great for this) Thanks again, Kent On Sep 23, 10:51 pm, Michael Bayer mike...@zzzcomputing.com wrote: yup, so what I can say is that this is one of the many fruits that await you when you get onto 0.7 :).    attribute stuff is very

[sqlalchemy] attributes.get_history() seems inconsistent when changing from NULL versus to NULL

2011-09-23 Thread Kent
]? Thanks, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group

[sqlalchemy] Re: attributes.get_history() seems inconsistent when changing from NULL versus to NULL

2011-09-23 Thread Kent
([current], (), deleted) So I guess the question is why and is that inconsistent with going to None? On Sep 23, 10:39 am, Kent jkentbo...@gmail.com wrote: I have two scalar columns in this example. (This is SQLAlchemy-0.6.4) = To NULL == print l.percentofsale1 100

[sqlalchemy] Re: attributes.get_history() seems inconsistent when changing from NULL versus to NULL

2011-09-23 Thread Kent
23, 1:12 pm, Michael Bayer mike...@zzzcomputing.com wrote: I can look later today, but what does 0.7 do?   Sent from my iPhone On Sep 23, 2011, at 11:17 AM, Kent jkentbo...@gmail.com wrote: I see the code specifically treats going from None as deleted = (): 1417                else

[sqlalchemy] Apparent inconsistency between defining Index() and UniqueConstraint()

2011-08-31 Thread Kent
Defining an Index() or UniqueConstraint() within a Table(...) adds the schema item to the table. Defining an Index() by passing one or more columns also adds the Index to the Table. However, defining a unique constraint by itself and passing columns does *not* add the constraint to the

[sqlalchemy] Re: Apparent inconsistency between defining Index() and UniqueConstraint()

2011-08-31 Thread Kent
Nevermind... my bad. I finally figured out you don't pass a name as the first parameter to a UniqueConstraint. Sorry. On Aug 31, 1:57 pm, Kent jkentbo...@gmail.com wrote: Defining an Index() or UniqueConstraint() within a Table(...) adds the schema item to the table.  Defining an Index

[sqlalchemy] attempting to override __sa_instrumentation_manager__

2011-08-25 Thread Kent
Assume I have a class hierarchy: class Base(object): __sa_instrumentation_manager__ = AttrManager class Order(Base): __sa_instrumentation_manager__ = OrderAttrManager This causes TypeError: multiple instrumentation implementations specified in Order inheritance hierarchy: I don't

[sqlalchemy] Re: attempting to override __sa_instrumentation_manager__

2011-08-25 Thread Kent
product.   I'd love to blow it away.   Anyway, if that's the error its giving you, then that's definitely one of its limitations :). On Aug 25, 2011, at 11:10 AM, Kent wrote: Assume I have a class hierarchy: class Base(object):  __sa_instrumentation_manager__ = AttrManager

[sqlalchemy] Re: attempting to override __sa_instrumentation_manager__

2011-08-25 Thread Kent
, at 12:41 PM, Kent wrote: We are still running 0.6.4 so I think that was the only way to implement events (set/append/remove), correct? On Aug 25, 12:38 pm, Michael Bayer mike...@zzzcomputing.com wrote: ho boy.  Why are you playing with instrumentation ?   That's a really obscure

Re: [sqlalchemy] Newbie question

2011-07-28 Thread Kent Tenney
On Wed, Jul 27, 2011 at 2:48 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 27, 2011, at 3:21 PM, Kent Tenney wrote: Howdy, I'm aggregating data from several Sqlite files into a Postgres db. The sqlite files are storage for several apps I use: Shotwell, Firefox, Zotero, Banshee

[sqlalchemy] Newbie question

2011-07-27 Thread Kent Tenney
. Thanks, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group

[sqlalchemy] Re: setting collection backref during merge()

2011-07-14 Thread Kent
, but can you recommend a hook or event where I could place some code to do this for certain cases (specifically many to one or one to one)? As of 0.6.4 there is no API hook for after merge, have you ever considered such or were you possibly even planning such? Thanks again, Kent On Jul 6, 5:07

[sqlalchemy] Re: session.delete() when not single parent

2011-07-09 Thread Kent
Thanks for your time and information. When I tried to create an example that wasn't so badly convoluted, it worked fine which led me to discover my problem. Thanks again, Kent On Jul 8, 11:32 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 8, 2011, at 5:28 PM, Kent wrote: Suppose I

[sqlalchemy] session.delete() when not single parent

2011-07-08 Thread Kent
: Dependency rule tried to blank-out primary key column. Because this is not single_parent, I do not want delete_orphan True. How can I accomplish deleting this instance? Thanks very much! Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] setting collection backref during merge()

2011-07-06 Thread Kent
If I merge() an object with a collection property, the backref's are not set as they would be if I had assigned the collection to the object. I expected that this should occur. Is there rationale for not setting backref's or would it be possible to make this change? Thanks, Kent -- You

[sqlalchemy] Re: Strange occasional ProgrammingError: Cannot operate on a closed database

2011-04-26 Thread Kent Hsu
Thanks. It works after switching to NullPool. On 4月25日, 下午10時12分, Michael Bayer mike...@zzzcomputing.com wrote: the refresh 50 times aspect suggests it's concurrency-related.   SingletonThreadpool, the pool the SQLite dialect uses in 0.6, isn't the best choice for a file-based database so

[sqlalchemy] Re: Strange occasional ProgrammingError: Cannot operate on a closed database

2011-04-25 Thread Kent Hsu
I got the same error. My web applicaiton works fine with sa0.5, but does not work since sa0.6. The situation is much like the follow link. https://github.com/Pylons/pyramid/issues/174 Best Regards, Kent Hsu On 4月22日, 上午11時36分, Roy H. Han starsareblueandfara...@gmail.com wrote: Lately, I've

[sqlalchemy] default viewonly=True when lazy='dynamic'

2011-04-20 Thread Kent
Just a suggestion, but wouldn't we want to always default viewonly=True when lazy='dynamic'? Or are there use cases such that the orm can actually still be expected to understand the relationship correctly even when unknown filter criteria are added? -- You received this message because you

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

2011-04-19 Thread Kent
an association proxy for the keywords via the post, but the question remains.) Thanks as always, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email

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

2011-04-19 Thread Kent Bower
? On 4/19/2011 11:47 AM, Michael Bayer wrote: On Apr 19, 2011, at 9:04 AM, Kent wrote: I'm getting an SAWarning (0.6.4 and also 0.7b5dev) which has a message that confuses me, so I've duplicated the problem with a script: === mapper(PostSpotLight

[sqlalchemy] Exception instead of warning when uselist=False returns more than one

2011-04-18 Thread Kent
would raise an exception instead of a warning? I'm not happy about these database relationships in the first place, so if the data is corrupt, I don't want to silently ignore the problem, I really want an exception raised. What are your thoughts? Kent -- You received this message because you

[sqlalchemy] Re: Exception instead of warning when uselist=False returns more than one

2011-04-18 Thread Kent
Excellent. Thanks. On Apr 18, 1:50 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Apr 18, 2011, at 1:30 PM, Kent wrote: For relations that aren't fully normalized, you occasionally need uselist=False to specify one to one relationships  (and maybe other reasons). Currently

[sqlalchemy] setting MapperProperty lazy attribute after property is created

2011-03-05 Thread Kent
the property and replace it with a new one with a difference lazy attribute? Thanks as always, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email

[sqlalchemy] Re: setting MapperProperty lazy attribute after property is created

2011-03-05 Thread Kent
, Kent wrote: Oracle 8 strikes again.  But our client's current legacy application requires it (until we can get them off the app). Anyway, when Oracle 8 is detected, I wish to convert certain mapper properties' lazy attribute from False = 'subquery' because oracle 8 isn't smart enough

[sqlalchemy] Re: setting MapperProperty lazy attribute after property is created

2011-03-05 Thread Kent
Yep, works excellent (the Why?? I asking about why is it wrong to invoke prop.do_init() instead of StrategizedProperty.do_init(prop)) On Mar 5, 11:31 am, Michael Bayer mike...@zzzcomputing.com wrote: On Mar 5, 2011, at 11:18 AM, Kent wrote: Thank you! I don't disagree: I've been

[sqlalchemy] Re: setting MapperProperty lazy attribute after property is created

2011-03-05 Thread Kent
Would you add a StrategizedProperty is_eager() method? class StrategizedProperty(MapperProperty): ... @property def is_eager(self): return self.lazy in (False, 'joined', 'subquery') ... Actually, I guess it would belong as part of class RelationshipProperty instead. Kent

[sqlalchemy] Query mechanism for converting lazy loaded relationships into subqueryload

2011-02-14 Thread Kent
I have a subclassed MyQuery. Would finding and converting these via a query method be fairly straightforward? (I suspect these may not be resolved until later) Can you suggest a better approach? Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] Re: Query mechanism for converting lazy loaded relationships into subqueryload

2011-02-14 Thread Kent
really looking forward to the day you don't need to support oracle 8 anymore Certainly you realize I feel *exactly* the same!!! ;) Normally I leave the eagerload stuff to query time as query options.   So there's not much challenge there, just use a function that returns

[sqlalchemy] Re: FOR UPDATE OF

2011-02-07 Thread Kent
On Feb 4, 12:04 pm, Kent jkentbo...@gmail.com wrote: Excellent, it is working for the simpler case, but for oracle 8 (who isn't as smart when indexing) I also need it to work for subqueryload(). So the problem is that my FOR UPDATE OF is also being added for subqueryload selects. * Can I

[sqlalchemy] Re: FOR UPDATE OF

2011-02-07 Thread Kent
: On Feb 7, 2011, at 11:16 AM, Kent wrote: On Feb 4, 12:04 pm, Kent jkentbo...@gmail.com wrote: Excellent, it is working for the simpler case, but for oracle 8 (who isn't as smart when indexing) I also need it to work for subqueryload(). So the problem is that my FOR UPDATE OF is also being

[sqlalchemy] Re: FOR UPDATE OF

2011-02-07 Thread Kent
want something this incomplete/be willing to help me get it right? (concern I'd take as much of your time as it would take you to do it...) Let me know. Kent On Feb 7, 11:32 am, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 7, 2011, at 11:26 AM, Kent wrote: For whatever reason I

[sqlalchemy] Re: FOR UPDATE OF

2011-02-04 Thread Kent
) name += '.' + mapper.primary_key[0].name rendered = %s FOR UPDATE OF %s % (rendered, name) return rendered On Feb 3, 9:51 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 3, 2011, at 9:29 PM, Kent wrote: Yeah, I wanted to apologize because my heart wants to contribute

[sqlalchemy] FOR UPDATE OF

2011-02-03 Thread Kent
in advance, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit

[sqlalchemy] Re: FOR UPDATE OF

2011-02-03 Thread Kent
_compile_context to plug it onto context.statement). Or if you want to provide a full patch with unit tests, that works too and I'll commit. On Feb 3, 2011, at 4:39 PM, Kent wrote: session.query(Cls).with_lockmode('update') will render FOR UPDATE Is there a way to render FOR UPDATE OF table

[sqlalchemy] Re: FOR UPDATE OF

2011-02-03 Thread Kent
Here is a crude outline (need to properly escape table name, etc.), of what I think might work, and it seems to render properly, but crashes with: File /home/rarch/tg2env/lib/python2.6/site-packages/ SQLAlchemy-0.6.4.2kbdev-py2.6-linux-x86_64.egg/sqlalchemy/engine/ default.py, line 353, in

[sqlalchemy] Re: FOR UPDATE OF

2011-02-03 Thread Kent
this is a little simpler than what I had in mind, you just have to add the mixin expression.Executable to your ForUpdateOf class. On Feb 3, 2011, at 9:05 PM, Kent wrote: Here is a crude outline (need to properly escape table name, etc.), of what I think might work, and it seems to render

[sqlalchemy] attributes.get_history() from mapper extension's before_update()

2011-01-15 Thread Kent
Is it safe trust attributes.get_history(instance, attrname) from mapper extension's before_update()? I assume this is not reset until later? Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] Re: transaction control when mixing SQL and sqla

2010-12-17 Thread Kent
= Session(e) s.execute(CREATE TABLE foo (data VARCHAR)) s.execute(INSERT INTO foo (data) VALUES ('data1')) s.commit() s.close() e = create_engine('sqlite:///test.db', echo=True) assert e.execute(SELECT * FROM foo).fetchall() == [('data1',)] On Dec 16, 2010, at 2:37 PM, Kent wrote

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

2010-11-06 Thread Kent
circumstances, (maybe for many to many?), parameters is a tuple? AttributeError: 'tuple' object has no attribute 'items' Can you explain when (if time, why)? How can I fix my code? Thanks! Kent On Nov 4, 11:42 am, Michael Bayer mike...@zzzcomputing.com wrote: On Nov 4, 2010, at 11:16 AM, Kent

[sqlalchemy] Universal way to process inserting or updating values

2010-11-04 Thread Kent
and INSERT column values, and, if the value is the empty string, replace with None/null? Thanks in advance if you can point me in the right direction. Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

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

2010-11-04 Thread Kent Bower
Bayer wrote: On Nov 4, 2010, at 11:16 AM, Kent wrote: We are writing an application that can run on PostgreSQL or Oracle. Since postgres treats NULL and '' (empty string) differently, while Oracle treats '' as NULL, this can cause subtle behavior differences based on the underlying database. Can you

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,

[sqlalchemy] after_attach()

2010-10-22 Thread Kent
because it hasn't been added to session.new yet on an add. Thanks in advance, Kent -- 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

[sqlalchemy] Re: after_attach()

2010-10-22 Thread Kent
It looks like if has_identity(instance), then I am guaranteed it is an add, can you confirm this is accurate? Thanks, Kent On Oct 22, 5:39 pm, Kent k...@retailarchitects.com wrote: I am using a SessionExtension. The docs state for after_attach(session, instance):     Execute after

[sqlalchemy] Re: after_attach()

2010-10-22 Thread Kent
Actually, I meant if not has_identity(instance) then I am guaranteed it is an add, correct? Kent On Oct 22, 5:56 pm, Kent k...@retailarchitects.com wrote: It looks like if has_identity(instance), then I am guaranteed it is an add, can you confirm this is accurate? Thanks, Kent On Oct

[sqlalchemy] before_insert for MapperExtension

2010-10-15 Thread Kent
Suppose I have a collection of new objects in a one to many relationship list. (A plain python list is instrumented for the collection) Am I guaranteed that the objects' MapperExtension's before_insert() method will be invoked in the same order as the items in the collection? Thanks, Kent

[sqlalchemy] python functions as column default

2010-10-08 Thread Kent
If I set up a default= function on a column like this: def default_user_initials(context): return context.current_parameters['user_name'] Column(_initials_, Unicode(16), nullable=False, default=default_user_initials) Then I am passed the 'context' object. Is there any way to get the

[sqlalchemy] Re: python functions as column default

2010-10-08 Thread Kent
Nevermind, I believe the MapperExtension.before_insert() .before_update(), etc. was created for my use case. On Oct 8, 10:50 am, Kent k...@retailarchitects.com wrote: If I set up a default= function on a column like this: def default_user_initials(context):         return

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
for your help. On 9/10/2010 3:27 PM, Michael Bayer wrote: Sent from my iPhone On Sep 10, 2010, at 2:11 PM, Kent Bowerk...@retailarchitects.com wrote: I'm headed that direction now, thanks. I didn't find anything on the wiki for how to plug in a subclassed CollectionAttributeImpl, for example

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
manually (unless you feel like enhancing that as well). Now I can manually emulate the obj being persistent with your changes for On Sep 6, 2010, at 10:58 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 6, 2010, at 9:06 AM, Kent wrote: with_parent seems to add a join condition

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

[sqlalchemy] Re: Loading attributes for Transient objects

2010-09-03 Thread Kent
again, Kent -- 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, visit this group

[sqlalchemy] Loading attributes for Transient objects

2010-09-01 Thread Kent
SQL, despite this being a Transient object, so I can manually populate this attribute. Thanks very much in advance. Kent -- 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

[sqlalchemy] Formula for determining Transient, Pending, Persistent, Detached

2010-09-01 Thread Kent
Please correct me if I'm mistaken and let me know if there is a better way: if attributes.instance_state(instance).has_identity: instance is Persistent or Detached if attributes.instance_state(instance).session_id: instance is Pending or Persistent Thanks, Kent -- You received

[sqlalchemy] Re: Formula for determining Transient, Pending, Persistent, Detached

2010-09-01 Thread Kent
I suppose attributes.instance_state(instance).session_id is not None is more correct than attributes.instance_state(instance).session_id On Sep 1, 11:30 am, Kent k...@retailarchitects.com wrote: Please correct me if I'm mistaken and let me know if there is a better way

[sqlalchemy] conditional joins/relationships

2010-08-20 Thread Kent
of being able to tell the *mapper* about it and treat it like a normal relationship. Is there an elegant way to accomplish this type of conditional join/ relation? Thanks in advance, Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] conditional joins/relationships

2010-08-20 Thread Kent Bower
' is meant for. Thanks for pointing me that way. On Fri, 2010-08-20 at 11:58 -0700, Kent wrote: I've run into this a variant of this same problem several times now, so I want to ask if you know of a good way to solve the problem. Some relation()s are based on extra criteria (besides primary key joins

Re: [sqlalchemy] SqlAlchemy logging FAQ

2010-08-18 Thread Kent Bower
... Instead, its default .ini file should leave the flag alone. I've directed TG group to this thread, thanks for your help. On 8/18/2010 10:58 AM, Michael Bayer wrote: On Aug 17, 2010, at 11:45 AM, Kent wrote: The logging FAQ states Therefore, when using Python logging, ensure

[sqlalchemy] SqlAlchemy logging FAQ

2010-08-17 Thread Kent
The logging FAQ states Therefore, when using Python logging, ensure all echo flags are set to False at all times, to avoid getting duplicate log lines. http://www.sqlalchemy.org/docs/dbengine.html#configuring-logging Is this no longer correct information? I am using turbogears (which creates the

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

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

2010-08-14 Thread Kent
the use of RETURNING with oracle 8i, or was it believed to not be supported? (Note that I don't believe Oracle 8.0 supports it... I read it was implemented in 8i) Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

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

2010-08-14 Thread Kent Bower
and the like in later versions...) Kent On 8/14/2010 10:42 AM, Michael Bayer wrote: On Aug 14, 2010, at 9:34 AM, Kent wrote: I'm connecting to a legacy database, some tables that I need to map in sqla have no primary key. I've created views for such tables that map the ROWID as the primary

[sqlalchemy] Re: User DataType for casting

2010-08-12 Thread Kent
On Jul 30, 7:25 am, Kent k...@retailarchitects.com wrote: Also, I'm afraid the CAST(NULL AS VARCHAR(255)) doesn't work with Oracle 8, but I don't have access to Oracle 8 at the moment.  I'm afraid you need TO_NUMBER(NULL) or TO_CHAR(NULL), etc... I'm wrong, CAST seems to work fine on Oracle

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

[sqlalchemy] Merge support with ConcreteInheritedProperty

2010-07-31 Thread Kent
I'm having a problem trying to merge() an object for which I have setup a polymorphic_union: artran_union = polymorphic_union({ 'artran': artrans_table, 'archive': artransarchive_table }, 'type', 'artran_union') artranbase_mapper = mapper(ArTranBase, artran_union,

[sqlalchemy] Re: User DataType for casting

2010-07-30 Thread Kent
wrote: the idiomatic solution would be: class RowID(Unicode):     pass from sqlalchemy.ext.compiler import compiles @compiles(RowId): def compile_rowid(compiler, element, **kw):     return ROWID we should add ROWID to the oracle dialect. On Jul 29, 2010, at 12:54 PM, Kent wrote: I

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

2010-07-30 Thread Kent
Hopefully you've got time to read a compliment: this polymorphism is very cool (well, sqla in general). Great work! Kent On Jul 29, 5:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 29, 2010, at 5:00 PM, Kent Bower wrote: Right.  I understand.  Thanks for pointing that out, you

[sqlalchemy] Re: how to use primary/secondary join when there are no foreign keys

2010-07-30 Thread Kent
I believe that you want your branche relation() on Cisdata, not Branchen. Additionally, I think you only want to list foreign_keys in foreign_keys=[]. My guess is: foreign_keys = [tables['cisbr'].c.ID_cisbr, tables['branchen'].c.ID_br] On Jul 30, 1:07 am, robert rottermann rob...@redcor.ch

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

2010-07-30 Thread Kent
I am having a problem when I'm specifying an order_by for a relationship entity's column when the relationship is this polymorphic_union. orders = DBSession.query(Order)\ .options(joinedload(Order.transactions))\ .filter(Order.customerid==customerid)\

[sqlalchemy] User DataType for casting

2010-07-29 Thread Kent
I'm using an Oracle legacy database and can't add a primary key to a table with none, so I am using ROWID as the primary key so sqlalchemy has a unique id. I'm also using (attempting to use) this table pornographically (Concrete Table Inheritance). The trouble I'm having is that Oracle complains

[sqlalchemy] Re: User DataType for casting

2010-07-29 Thread Kent
Oops! I didn't check my spell checker closely I meant 'polymorphically' not 'pornographically'!! -- 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,

[sqlalchemy] Re: User DataType for casting

2010-07-29 Thread Kent
I worked out this solution: class RowID(Unicode): def _compiler_dispatch(self, type_): return ROWID Please let me know if there are any obvious implications that I may have overlooked. Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy

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

2010-07-29 Thread Kent
I'm getting a messy error that could be a bug, but is very likely related to my setup of a set of 2 polymorphic classes I am attempting to map. One entity is a transaction and the other is a transaction_archive record. The table structure is therefore very similar for both tables and it seems to

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

<    1   2   3   4   >