On 17 Apr 2014, at 04:43, Chip Kellam blackroomd...@gmail.com 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
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
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, how
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
[Relationship Washington, George Washington, Martha (Marriage)]
But when I add this
On Thu, Apr 17, 2014 at 5:28 PM, Mats Nordgren mats.nordg...@gmail.com 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
[Relationship
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 =
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')
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:04
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
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
Awesome, thanks so much for the quick response.
On Sun, Apr 13, 2014 at 7:00 PM, Michael Bayer mike...@zzzcomputing.comwrote:
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
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
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 tried with the sample code, and I get the following:
File /Users/joshma/aurelia/benchling/models/folder.py, line 273, in
module
configure_mappers()
File
/Users/joshma/.envs/aurelia/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py,
line 2560, in configure_mappers
14 matches
Mail list logo