[sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent
else: # assume postgres return func.coalesce How would I work that out? Thank you in advance. On Apr 2, 4:12 pm, Michael Bayer mike...@zzzcomputing.com wrote: Kent wrote: Any chance you plan to make func.now consider oracle and use_ansi=False (and return sysdate

[sqlalchemy] Re: use_ansi oracle sysdate vs. current_date

2010-04-02 Thread Kent
ian.g.ke...@gmail.com wrote: On Fri, Apr 2, 2010 at 3:41 PM, Michael Bayer mike...@zzzcomputing.comwrote: 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

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

2010-04-29 Thread Kent
? In the meantime, can you recommend an approach for me? (Extend the Session class?) Thanks much, 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

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

2010-04-29 Thread Kent
That sounds like it could be very useful for me, thank you for pointing me there. That could solve one of the two issues I'm facing that I listed... what about the other? On Apr 29, 11:02 am, Michael Bayer mike...@zzzcomputing.com wrote: Kent wrote: Before saving objects to the database, we

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

2010-04-29 Thread Kent
that calculation. Kent wrote: That sounds like it could be very useful for me, thank you for pointing me there.  That could solve one of the two issues I'm facing that I listed... what about the other? On Apr 29, 11:02 am, Michael Bayer mike...@zzzcomputing.com wrote: Kent wrote: Before

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

2010-04-30 Thread Kent
I think I've got a strategy that will work and doesn't mean hacking merge()... Thanks for your input, if you have inspiration, I'll still gladly hear it. On Apr 30, 8:18 am, Kent Bower k...@retailarchitects.com wrote: Thanks in advance for the discussion, hope I can continue without you

[sqlalchemy] upgrade to SQLA 0.6

2010-04-30 Thread Kent
I did read 0.6 Migration document. I was using the contains_column method of ForeignKeyConstraint. Apparently removed? AttributeError: 'ForeignKeyConstraint' object has no attribute 'contains_column' Easy workaround or replacement call? -- You received this message because you are subscribed

[sqlalchemy] Re: preserving uselist relation instances in a session.refresh()

2010-05-01 Thread Kent
Is it rude to ask why not disable the weakidentity map? Under the turbogears web framework, our Sessions only exist for the duration of the service call, and I am finding myself appending all these objects to a no_garbage_collect list that I am keeping on the session object anyway. Then the

[sqlalchemy] Re: preserving uselist relation instances in a session.refresh()

2010-05-01 Thread Kent
, correct? In other words, for my understanding, or others reading the list, in a framework where a session's life cycle only lasted as long as a web service call, the threat of the program's memory growing unbounded is non-existent, correct? Kent -- You received this message because you

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

2010-05-03 Thread Kent
The following script works as expected (also in 0.5.8) with use_ansi=True. However, with use_ansi=False, the SQL is ill-formed: === from sqlalchemy import * from sqlalchemy.orm import * engine =

[sqlalchemy] disable RETURNING for specific primary key columns

2010-05-04 Thread Kent
are on a legacy oracle system or a postgres database. In some cases the 'tables' are views that don't support RETURNING, so I'd like to turn it off for those cases only...) Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

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

2010-05-06 Thread Kent
I guess my suggestion is: since Oracle takes DECIMAL and NUMERIC to mean NUMBER(38), if SQLAlchemy interprets the generic types DECIMAL or Numeric with no precision to allow for decimal or integer values, we should translate that to 'NUMBER' for Oracle... Thoughts? On May 6, 12:11 pm, Kent

[sqlalchemy] joins use old data

2010-05-06 Thread Kent
seems wrong. A longer term enhancement to sqla might be to automatically expire any relation whose join columns include a column that gets updated in a session? Is that a manageable effort? Kent -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

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

2010-05-07 Thread Kent
Mike, Can I just take a second to thank you for your patience in running this forum? There are so many rude, arrogant software developers, and you seem to not be like them at all. Thanks. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to

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

2010-05-10 Thread Kent
See this script, running 0.6.0: == from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('oracle://user:passw...@localhost:1521/xe? use_ansi=False',echo=True) metadata = MetaData() Session = sessionmaker(bind=engine) session

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

2010-05-17 Thread Kent
We will definitely also need a migration tool. We've only briefly looked into the sqlalchemy-migrate tool, but were immediately disappointed in its apparent requirement to keep versions of the schema. In our book, we see the ideal tool as one that doesn't care about versions: it just looks at the

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

2010-05-17 Thread Kent
After migrating to 0.6, we've got an apparently well running application for postgres and Oracle 9 or above. However, as soon as we connect to an Oracle 8 database, *everything* we attempt ends with this: oracle error: ORA-00907: missing right parenthesis Here is an example trying to run a

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

2010-05-17 Thread Kent
this particular interaction doesn't go through regular SQLAlchemy logging.   If you really needed to see it occur you'd have to watch your oracle query logs. On May 17, 2010, at 3:37 PM, Kent wrote: After migrating to 0.6, we've got an apparently well running application for postgres

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

2010-05-17 Thread Kent
Sorry, posted too quickly, I'll get the rest of the results you asked about... On May 17, 4:56 pm, Kent k...@retailarchitects.com wrote: Connected to: Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production With the Partitioning option JServer Release 8.1.7.4.0 - Production Session

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

2010-05-17 Thread Kent
sqlalchemy.engine.base.Engine.0x...fb50 {} ORA-12704: character set mismatch (8, 1, 7, 4, 0) On May 17, 4:58 pm, Kent k...@retailarchitects.com wrote: Sorry, posted too quickly, I'll get the rest of the results you asked about... On May 17, 4:56 pm, Kent k...@retailarchitects.com wrote

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

2010-05-18 Thread Kent
Ignore everything below unicode_for_unicode = False for Oracle lower than 9? in previous post, I meant to delete those lines -- 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

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

2010-05-18 Thread Kent
SELECT CAST('test unicode returns' AS NVARCHAR(60)) AS anon_1 FROM DUAL then it seems like either that fails directly, or it fails when the client gets a hold of it.   See what happens with that statement.   Not sure that Oracle 8 has NVARCHAR which might be the issue. Please see the

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

2010-05-18 Thread Kent
* ERROR at line 1: ORA-00907: missing right parenthesis = On May 18, 12:15 pm, Kent k...@retailarchitects.com wrote: SELECT CAST('test unicode returns' AS NVARCHAR(60)) AS anon_1 FROM DUAL then it seems like either that fails

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

2010-05-18 Thread Kent
version. It also states you can *not* store Unicode in the NCHAR datatype until Oracle 9i. On May 18, 1:23 pm, Kent Bower k...@retailarchitects.com wrote: 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

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

2010-05-18 Thread Kent
VARCHAR2 for unicode data.  i wasn't aware of the N- types at that time. also the suite of changes here is going to roll in the use_ansi flag into the oracle 8 detection, its a bit redundant to require it manually. On May 18, 2010, at 1:29 PM, Kent wrote: There is a fairly short Oracle

[sqlalchemy] mapper properties' class types: SynonymProperty

2010-05-25 Thread Kent
When introspecting a mapper, we can figure out the class type of its properties like this: For ColumnProperty: prop.columns[0].type.__class__ For RelationProperty (relationship): prop.argument For RelationProperty (backref): prop.argument.class_ How do I determine the class type a

[sqlalchemy] Re: mapper properties' class types: SynonymProperty

2010-05-25 Thread Kent
One answer is, I believe, use the name property to access the mapped property, like this: prop.parent.get_property(prop.name) Is there a better way? On May 25, 8:54 am, Kent k...@retailarchitects.com wrote: When introspecting a mapper, we can figure out the class type of its properties like

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

2010-05-27 Thread Kent
The docs state For each begin_nested() call, a corresponding rollback() or commit() must be issued. In PostgreSql, according to my understanding, if there is ever a database exception, a rollback must be issued. This means a main reason to issue a SAVEPOINT is as a hedge against an error. As

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

2010-05-28 Thread Kent
commit? I assume the answer is yes, that is by design. Which leads to this question: Inside a SessionExtension's before_commit() method, how can I work out whether this is a nested transaction vs. the root transaction? Thanks, Kent -- You received this message because you are subscribed

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

2010-05-28 Thread Kent
Is the answer to second questoin session.transaction.nested? On May 28, 1:24 pm, Kent k...@retailarchitects.com wrote: On May 27, 6:39 pm, Michael Bayer mike...@zzzcomputing.com wrote: commit() releases the savepoint, if thats whats going on contextually.   It doesnt actually commit

[sqlalchemy] zope.sqlalchemy with sqla 0.6

2010-05-31 Thread Kent
for looking into this. Let me know if I can help further. 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

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

2010-06-04 Thread Kent
Say I track Inventory with three classes: Product, Inventory, Location This any() expression yields the following output. session.query(Product).filter(Product.inventory.any(Location.siteid==u'EAST')).all() SELECT ... FROM products WHERE EXISTS (SELECT 1 FROM inventory, locations WHERE

[sqlalchemy] finding mapper from table

2010-07-13 Thread Kent
I know how to get the mapper given a class or object. How do I find the mapper or class given the table? -- 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

[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

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

2010-07-29 Thread Kent
, cascade='refresh-expire,expunge', lazy=False), 'paymenttype': relation(PaymentType, cascade='refresh-expire,expunge', lazy=False)} ) On Jul 29, 4:20 pm, Kent Bower k...@retailarchitects.com wrote: No, in fact, there is no ArTranBase table

[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] 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-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

[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

[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

[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

[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] 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] 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

[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] 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] 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

[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] 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] 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] 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] 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] 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] 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] 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] 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] 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

[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] 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] 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] 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] 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] 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

[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] 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] 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] 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] 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] 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

  1   2   3   4   >