Mike's suggestion is correct, and I want to add that relationship() /
relation() do not require a foreign key constraint, they just are
able to figure out the mapping more automatically (without a
primaryjoin argument in unambiguous cases) if you do have one existing
on the table.
On Mar 15,
I am trying to create a property on a mapped class which basically
executes a subquery. Here is what I'm trying to do in non-working
pseudo code:
mapper(OrderChain, Table('order_chains',self.meta,
autoload=True),
properties={'entries': relation(OrderChainEntry,
Hi all,
This is probably a simple problem, but so far I haven't figured out
how to resolve it. I've got some SqlAlchemy tables and am trying to
change an attribute of a SqlAlchemy object returned from a query.
However, when I change the attribute value, no SQL update statement is
generated by the
this kind of pattern is usually handled by column_property(), assuming you can
correlate your subquery to the parent within the WHERE clause such that the
return value is a scalar.
Below if you really just wanted the first row you'd want to say limit(1).
If you really want that exact same
On Mar 16, 2011, at 3:38 PM, writeson wrote:
Hi all,
This is probably a simple problem, but so far I haven't figured out
how to resolve it. I've got some SqlAlchemy tables and am trying to
change an attribute of a SqlAlchemy object returned from a query.
However, when I change the
Michael,
there's nothing obviously wrong with the above other than the unusual naming
scheme of Col, Int, and FK. Two steps to take are to assert that
the object is dirty, assert item in session.dirty, and the attribute has a
change, from sqlalchemy.orm import attributes; assert
I hope this makes sense, what I'm trying to do here. My naive first
try at it was to just see if I could have the desired backref()s on
either the A or C class, and manage to have the relationship go
through the associationproxy. Probably I should be thinking of a
technical reason why we would
On Mar 16, 2011, at 4:09 PM, writeson wrote:
Michael,
there's nothing obviously wrong with the above other than the unusual naming
scheme of Col, Int, and FK. Two steps to take are to assert that
the object is dirty, assert item in session.dirty, and the attribute has a
change,
I have an error i cant figure out (likely a beginners error):
#
Base = declarative_base()
class tablemeta(DeclarativeMeta):
def __new__(mcls, name):
return DeclarativeMeta.__new__(mcls, name, (Base,), {})
def _init__(cls,
Hello everyone!
In my application I have a class Store that can contain several
UserGroups (for permission purposes) and one UserGroup can belong
to several Stores.
I want to get the Stores that contain a certain UserGroup (instance):
I have it modeled like this:
class Store(declarativeBase):
Cr*p!... 5 minutes after writing, I got it:
query = session.query(Store.Store).select_from(join(Store.Store,
UserGroup.UserGroup,
Store.Store.userGroups)).filter(UserGroup.UserGroup.id ==
int(userGroupId))
http://www.sqlalchemy.org/docs/orm/tutorial.html#querying-with-joins
Well... it may help
Hello everyone!
I am reopening that because now I want to go an step further... And
I'm having troubles.
Let's say I have an Store class that has a relationship pointing to
UserGroup that has a relationship pointing to Users.
I'm trying to create a method getStoresByUserId(parameterUserId)
Hi everyone,
I am currently in work experience ...
The first step of my work was to build a small application using
sqlalchemy.
Association proxy seems to allow to simplify many-to-many
relationships management.
Can i use it to store define a class with an attribute which is a list
of string
On Mar 16, 2011, at 8:12 PM, zaza witch wrote:
Hi everyone,
I am currently in work experience ...
The first step of my work was to build a small application using
sqlalchemy.
Association proxy seems to allow to simplify many-to-many
relationships management.
Can i use it to store
14 matches
Mail list logo