Re: [sqlalchemy] Tutorial/Example Code

2012-05-22 Thread David Bowser
t;instrument_class" event here, you should > be able to create the remote class as the primary one is created. > > On May 22, 2012, at 2:28 PM, David Bowser wrote: > >> Hi, >> >> I had a lot of trouble finding a decent set of examples on how to write a >

[sqlalchemy] Tutorial/Example Code

2012-05-22 Thread David Bowser
ified, and commented an example, but I didn't see how to submit it for consideration for use the in the documentation. Please see attached. ~David Bowser -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group,

Re: [sqlalchemy] Multi-table (polymorphic?) row-specific relations

2012-05-02 Thread David Bowser
Nope, just use the one inside the scope, TagMixin.TagClass, like so for your example: session.add(User.TagClass(tagged=doc1,name='foo')) On May 2, 2012, at 5:07 AM, Ciaran Farrell wrote: > But how would you actually add a tag? For example, say, using the example you > provided below, I had

Re: [sqlalchemy] how to filter a timestamp field by date ?

2012-04-30 Thread David Bowser
You're looking for func which generates SQL function expressions. See: http://docs.sqlalchemy.org/en/latest/core/expression_api.html For your example: from sqlalchemy.sql.expression import func session.query(Posting).filter(func.date(Posting.timestamp_created)==func.date(my_var)).all() On A

Re: [sqlalchemy] Mixin relationship defaulting to uselist=False unexpectedly

2012-04-24 Thread David Bowser
On Apr 24, 2012, at 7:18 PM, David Bowser wrote: > > On Apr 24, 2012, at 6:14 PM, Michael Bayer wrote: > >> >> On Apr 24, 2012, at 5:59 PM, David Bowser wrote: >> >>> >>> On Apr 24, 2012, at 5:50 PM, Michael Bayer wrote: >>> >>

Re: [sqlalchemy] Mixin relationship defaulting to uselist=False unexpectedly

2012-04-24 Thread David Bowser
On Apr 24, 2012, at 6:14 PM, Michael Bayer wrote: > > On Apr 24, 2012, at 5:59 PM, David Bowser wrote: > >> >> On Apr 24, 2012, at 5:50 PM, Michael Bayer wrote: >> >>> one-to-many is defined as parent->child where child has a foreign key >>>

Re: [sqlalchemy] Mixin relationship defaulting to uselist=False unexpectedly

2012-04-24 Thread David Bowser
On Apr 24, 2012, at 5:50 PM, Michael Bayer wrote: > one-to-many is defined as parent->child where child has a foreign key column > referring to parent; many-to-one is the reverse, where parent has a foreign > key that refers to child. When you tell the ORM "foreign_keys = > [some_col_on_pare

Re: [sqlalchemy] Mixin relationship defaulting to uselist=False unexpectedly

2012-04-24 Thread David Bowser
On Apr 24, 2012, at 3:36 PM, Michael Bayer wrote: > > On Apr 24, 2012, at 1:16 PM, David Bowser wrote: > >> I have a mixin as follows designed to remove a bunch of copy paste >> relationship code. >> >> class UserMixin(object): >> @_declared_attr

[sqlalchemy] Mixin relationship defaulting to uselist=False unexpectedly

2012-04-24 Thread David Bowser
I have a mixin as follows designed to remove a bunch of copy paste relationship code. class UserMixin(object): @_declared_attr def user_id(cls): return sa.Column('user_id',typ.Integer,sa.ForeignKey("tg_user.user_id", ondelete="CASCADE"),nullable=False) @_declared_attr de

[sqlalchemy] Creating an index on an expression

2012-04-03 Thread David Bowser
With postgres in raw sql I can do create an index like: "CREATE INDEX users_lower_username_idx ON users (lower(username));" How would I do this in sqlalchemy using a declarative model? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to