I tried with the sample code, and I get the following:
File "/Users/joshma/aurelia/benchling/models/folder.py", line 273, in
configure_mappers()
File
"/Users/joshma/.envs/aurelia/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py",
line 2560, in configure_mappers
mapper._post_config
OK well this stage to create an Index is just not deferred enough, and text()
is not supported. Declarative has to make a "name" column that is part of
MyModel by copying it because it's coming from a mixin and that just hasn't
happened yet, the Column is not the right object yet. The Table i
Hi Mike,
In hindsight I might have responded prematurely - got around to trying it
and with text() I get the following:
__table_args__ = (
...
Index('folder_lower_name_idx', text('lower(name)'),
postgresql_ops={'name': 'text_pattern_ops'}),
)
File
"/Users/joshma/.envs/aur
Awesome, thanks so much for the quick response.
On Sun, Apr 13, 2014 at 7:00 PM, Michael Bayer wrote:
> you need to turn your __table_args__ into a callable:
>
> @declared_attr
> def __table_args__(cls):
> return (Index(…, func.lower(cls.name), …), )
>
> or just use a string for your functio
I don't like to have attributes added to classes on the fly, but the
back_populates keyword mentioned in your link seem to have solved it.
Still don't understand why the relationship worked with George but not
with Martha. Thanks a million for your though help Michael.
On Thursday, April 17
Hi all!
First of all: it's Mike approved :P
I'm Richard, CTO of Humantech Knowledge Management, a brazilian based
technology company with enphasis on data management, mining, storage,
and so son. We are engaged with the opensource community, interacting
and contributing (most of all bug patch
you want to link "relationships" and "source" using a backref, so that the
reference is updated both directions without doing a database round trip.
See
http://docs.sqlalchemy.org/en/rel_0_9/orm/relationships.html?highlight=backrefs#linking-relationships-with-backref
.
On Apr 17, 2014, at 1:
class Entity(Base):
'''A base for entities.'''
__tablename__ = 'entities'
id = Column(Integer, Sequence('entity_id_seq'), primary_key=True)
type = Column(String(50))
tax_id = Column(String(20))
memberships = relationship('Membership')
__mapper_ar
class Person(Entity):
'''A person.'''
__tablename__ = 'people'
id = Column(Integer, ForeignKey('entities.id'), primary_key=True)
first_name = Column(String(50))
middle_name = Column(String(50))
last_name = Column(String(50))
date_of_birth = Column(Dat
On Thu, Apr 17, 2014 at 5:28 PM, Mats Nordgren wrote:
> When I add the relationship below it displays the relationship list without
> issuing a commit.
>
session.add(Relationship(source=george, target=martha,
relationship_type=marriage))
george.relationships
> []
>
> But when I add
When I add the relationship below it displays the relationship list without
issuing a commit.
>>> session.add(Relationship(source=george, target=martha,
relationship_type=marriage))
>>> george.relationships
[]
But when I add this relationship it returns an empty list unless I issue a
session.c
this is a bit of a brain teaser because I don't know LINQ and we don't have an
"all()" operator. Spent a few minutes trying to guess what the heck "all()"
would query for; in SQL, it's very easy to check if a collection contains some
elements with some kind of criteria...but "all", I thought,
Hi everyone,
I am really lost on a query I try to formulate. In LINQ it would probably
like that (haven't done LINQ in quite some time):
from j in Job
where j.status == 'queued' and j.dependencies.all(d => d.status == 'done')
select j
So, Job.dependencies is a self-referential many-to-many asso
On 17 Apr 2014, at 04:43, Chip Kellam wrote:
> I have an application in which I primarily rely on MySQL/InnoDB and using the
> SQLAlchemy ORM and leveraging the transaction python module. Everything is
> good.
>
> My problem is that, try as I might, using code similar to the following, I
> c
14 matches
Mail list logo