[sqlalchemy] hybrid_property vs. hybrid_method, other than the latter can take arguments?

2016-08-23 Thread Jinghui Niu
Hi, I wonder if there is any recommendation or best practice on choosing between hybrid_property and hybrid_method , other than they hybrid_method can take arguments? If I use the hybrid_method only throughout, without giving it a argument more than self, doesn't it equal to using

[sqlalchemy] Custom Relationship property for Column with csv of integer keys

2016-08-23 Thread Torsten Landschoff
Hi *, this post is a bit short on data because I just wrote a long posting and it seems to have vanished when I hit the "POST" button. *sigh* I am trying to do something (admittedly crazy) like this, but without the after_flush hook - I'd rather like to tell the ORM that member_ids is

[sqlalchemy] Abusing a string column as list of foreign keys (own relationship class, based on DependencyProcessor?)

2016-08-23 Thread Torsten Landschoff
Hello everybody, I am currently pulling my hair out because I have a solution that I think should work on the database side (albeit I don't like it), but I can't figure out how to do this with sqlalchemy. My current goal is to manage (long-lived) locks on copy-on-write hierarchical data that

Re: [sqlalchemy] What criteria should I use to determine whether I need a distinct class-level expression for my hybrid attributes?

2016-08-23 Thread Mike Bayer
On 08/23/2016 11:31 AM, Jinghui Niu wrote: Thanks Mike. In future is it likely to have the instance level expression and class level expression automatically translated by ORM? It will be so much easier! well a very small subset of them already are, but beyond that it's an issue of

Re: [sqlalchemy] What criteria should I use to determine whether I need a distinct class-level expression for my hybrid attributes?

2016-08-23 Thread Jinghui Niu
Thanks Mike. In future is it likely to have the instance level expression and class level expression automatically translated by ORM? It will be so much easier! On Mon, Aug 22, 2016 at 7:20 AM, Mike Bayer wrote: > > > On 08/22/2016 03:20 AM, Jinghui Niu wrote: > >> I'm

Re: [sqlalchemy] Using Python functions in query with automap reflected tables?

2016-08-23 Thread Mike Bayer
On 08/22/2016 02:50 PM, Rahul Ahuja wrote: I'm having some trouble using Python string functions on VARCHAR columns in MySQL (reflected using automap_base() and base.prepare). I'm getting | AttributeError:Neither'InstrumentedAttribute'objectnor 'Comparator'objectassociated

Re: [sqlalchemy] SQLAlchemy. Creating tables that share enum

2016-08-23 Thread Mike Bayer
if you have an Enum with a certain name that is to be used in multiple tables, you can create it separately. Build the ENUM using the create_type=False flag to keep it from generating the type automatically, then use the .create() method to create it individually, docs at

Re: [sqlalchemy] Having SA generate constructor when using autoload.

2016-08-23 Thread Piotr Dobrogost
On Monday, August 22, 2016 at 12:54:27 PM UTC+2, Simon King wrote: > > > You'd probably be best off copying the SQLAlchemy code into your own > project - it's not long: > > >