hi there,
how can an instance of a class with a Table bound to it
access the values of the values of its db record?
what I would like to do is something like the following:
class company(Base):
__table__ = 'tblCompany'
...
def listAssignedProducts(self):
print assigned products
Hello everyone,
I've been using sqlalchemy with elixir for a legacy project for a
while now and recently needed to write some more than trivial queries.
I have the default elixir generated mappers but using only them forces
me to do some data processing in my app rather than in the database.
That document is great, i follow it and get the right solution below:
orm.mapper(User, user_table, properties={
'friends': orm.relation(User, secondary=friend_table, primaryjoin=
user_table.c.id == friend_table.c.user_id,
secondaryjoin=friends_table.c.friend_id == user_table.c.id),
})
Victor Lin wrote:
Hi,
I am writing a turbogears2 application, with elixir. I got a problem
when I try to create an new entity and attach it to another entity. I
create a simple program to repruduce the problem:
from elixir import *
class User(Entity):
name = Field(Unicode)
robert rottermann wrote:
hi there,
how can an instance of a class with a Table bound to it
access the values of the values of its db record?
what I would like to do is something like the following:
class company(Base):
__table__ = 'tblCompany'
...
def listAssignedProducts(self):
It sounds like you need a subquery that finds last order then construct a
query joining clients and orders to the subquery.
http://www.sqlalchemy.org/docs/05/ormtutorial.html?highlight=subquery#using-subqueries
Something like this:
class Client(Base):
__tablename__ = 'client'
id =
Noufal wrote:
Hello everyone,
I've been using sqlalchemy with elixir for a legacy project for a
while now and recently needed to write some more than trivial queries.
I have the default elixir generated mappers but using only them forces
me to do some data processing in my app rather
Michael Bayer wrote:
Victor Lin wrote:
It is a TODO within SQLAlchemy for this particular operation to not
trigger an unnecessary load.
I've added a patch as well as your test as
http://www.sqlalchemy.org/trac/ticket/1483 to address the unnecessary load
issue. It needs more testing to
Mike, I totally appreciate the help, but it's just not working, for me.
I feel like you've given tons of time on trying to fix this, so if anyone
else wants to step in to hit me with the clue stick, that would be delightful.
More details
db's tried: postgres, sqlite
sqlalchemy version:
Gregg Lind wrote:
session.query(Route.ts,Route.startpoint,Route.target,func.max(Route.hop_id).label('max_hop'))\
.group_by(Route.ts,Route.startpoint,Route.target).subquery()
q =
session.query(Route,sq.c.max_hop).join(sq,sq.c.max_hop==Route.hop_id)
q.all()
join takes tuples
Thank you! That tuple thing was a fail on my part, clearly.
Doing it exactly as you describe still doesn't get things to be, for
lack of a better term, correlated.
This, however, achieves what I want:
session.query(Route,sq.c.max_hop).join((sq,
and_(Route.hop_id==sq.c.max_hop,
I just ran across something I believe maybe a bug in session.refresh()
dealing with adjacency lists.
The situation is after a session.refresh() on a node (in my case a
'job'), the children and grandchildren
have some of their values overridden by the refreshed node. Calling
Forgot to mention this is SQLAlchemy 0.5.5
David Gardner wrote:
I just ran across something I believe maybe a bug in session.refresh()
dealing with adjacency lists.
The situation is after a session.refresh() on a node (in my case a
'job'), the children and grandchildren
have some of their
On Jul 23, 8:30 am, Ed Singleton singleto...@gmail.com wrote:
I've managed to get SA (0.6 branch) and pyodbc connecting to anMSSQL
db on Mac OS X, but I've recently been trying to get it working on
linux (Debian Lenny) and have been hitting some problems.
It's definitely working to some
14 matches
Mail list logo