I think you may be confused about the relationship properties you have
here. As far as I can tell, a Creator can have many companies, but
each Company has only one creator, correct? So Company.creator should
only ever be an instance of Creator (or None), whereas
Creator.companies should be a list.
On Tuesday, August 13, 2013 7:43:54 PM UTC-4, Michael Bayer wrote:
cross-schema reflection is supported on PG but has caveats, see
http://docs.sqlalchemy.org/en/rel_0_8/dialects/postgresql.html#remote-cross-schema-table-introspectionfor
a discussion of recommended usage patterns.
Hello all
Tried for hours to figure out the various relationship() options with no
luck.
Consider:
class Enrolment(base):
__tablename__ = 'enrolment'
person_id = Column(String, primary_key=True)
group_id= Column(String, primary_key=True)
enrol_date = Column(Date,
create a non primary mapper to a select() that's against the Enrolment table
joined to RosterLine (i.e. mapper(myselect.alias(), non_primary=True), then
construct a relationship() to that mapper (viewonly=True of course).
at some point I should add an example of this technique, it's just the
Simon, your idea about putting together a script is a good one. Please see
the attached. I think all these errors are related but I'm scratching my
head about what the problem is.
The reason I use self.creator[0] versus self.creator is for aesthetics.
And, to your point about creator not
As previously discussed, i'm using an object's history to log changes to
the database within an application.
http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html?highlight=history#sqlalchemy.orm.attributes.History
Each tuple member is an iterable sequence
I'm trying to figure out when I
I'm working with an existing MySQL schema that has lots of columns of
type ENUM('N', 'Y'). I'd like to deal with them as real booleans on
the python side.
I have a simple TypeDecorator which almost works (I think):
class YNBoolean(sqlalchemy.types.TypeDecorator):
impl =
Thanks for the quick response!
After much fiddling I got it working using alias(), foreign() and
corresponding_column(). It seems to get the right results.
Is this the simplest, right approach?
joined = Enrolment.__table__.join(RosterLine,
i'm trying to generate a list of non-deffered columns from an object
referencing this example:
class Book(Base):
__tablename__ = 'book'
book_id = Column(Integer, primary_key=True)
title = Column(String(200), nullable=False)
summary = Column(String(2000))
On Wednesday, August 14, 2013 12:10:12 AM UTC-5, Lukasz Szybalski wrote:
Hello,
How do I go from class like defeinition to below with mapper.
The docs in 0.8 say I can use:
from sqlalchemy.ext.declarative import DeferredReflectionBase =
declarative_base()
class
yes it will always be one element for a scalar reference, a collection for
collections. the ORM internally treats everything like a collection, kind of
another artifact that probably wouldnt have been the case if this API were
written for end-users originally...
On Aug 14, 2013, at 9:20 PM,
11 matches
Mail list logo