I've been struggling with a query that gets the most recent date as
described here: http://stackoverflow.com/a/123481/2966951
I've been able to produce a SQLAlchemy variant, but it seems to be MUCH
slower when executed with MySQL. It also looks slightly differentwith
parameters around the
*much slower when executed with MySQL compared to SQLite
Den torsdag 5 mars 2015 kl. 20:38:42 UTC+1 skrev Dani Hodovic:
I've been struggling with a query that gets the most recent date as
described here: http://stackoverflow.com/a/123481/2966951
I've been able to produce a SQLAlchemy
Dani Hodovic danih...@gmail.com wrote:
I've been struggling with a query that gets the most recent date as described
here: http://stackoverflow.com/a/123481/2966951
I've been able to produce a SQLAlchemy variant, but it seems to be MUCH
slower when executed with MySQL. It also looks
Are you sure? I just tested it (using the definitions from the
Simplifying Association Objects section) with the following at the
bottom:
if __name__ == '__main__':
user = User('log')
user.keywords = [Keyword('one'), Keyword('two')]
for uk in user.user_keywords:
print uk,
I haven't looked at your code closely so I'm not sure what the problem
is, but I'm not sure your creator factory should be necessary. The
association proxy docs say that something like:
kw = Keyword('one')
user.keywords.append(kw)
has the same effect as:
kw = Keyword('one')
uk =
Hello,
I have relation User-User2Group-Group with additional attribute System on
User2Group table.
The System is part of primary key, which means
*'user can me member of group via multiple systems'.*
class User(Base):
__tablename__ = 'User'
name = Column('Name', Unicode(256),
Hi,
Adding viewonly=True on User.groups relationship solved the issue.
cheers!
Dne čtvrtek 5. března 2015 11:26:58 UTC+1 Pavel S napsal(a):
Hello,
I have relation User-User2Group-Group with additional attribute System on
User2Group table.
The System is part of primary key, which means
Hi,
I just noticed that User.groups relationship is not needed at all (it was a
relict of previous setup before System column was added).
So the problem is completely gone.
---
I already use *AssociationProxy* pattern in order to have relations like
*User.A_groups,
User.B_group**s,
Glad you've figured it out. This is touched on briefly in the docs, in
the note at the bottom of:
http://docs.sqlalchemy.org/en/rel_0_9/orm/basic_relationships.html#association-object
As an alternative to making User.groups a relationship, you could also
consider using the Association Proxy
Yes.
However doing so:
user.keywords = [ Keyword('one'), Keyword('two') ]
...will create UserKeywords with user unset. This is the problem.
Dne čtvrtek 5. března 2015 15:11:20 UTC+1 Simon King napsal(a):
I haven't looked at your code closely so I'm not sure what the problem
is, but I'm not
10 matches
Mail list logo