Something exactly like that. Thanks much.
On Nov 8, 11:28 pm, Mike Conley mconl...@gmail.com wrote:
Something like this? The association table is declared in the relationships,
but never referenced when creating or accessing objects.
class Assoc(Base):
__tablename__ = 'assoc'
RT,
i'm using it now,
i want it's out when
i product is online.
--
my.unix-center.net/~WeiZhicheng
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to
Hi,
I have the following 2 declarative objects to represent a book and its
pages:
class Book(Base):
__tablename__ = 'books'
id = Column(Integer, primary_key=True)
title = Column(String(32))
class Page(Base):
__tablename__ = 'pages'
id = Column(Integer, primary_key=True)
The id is generate by the database engine, not SQLAlchemy, so session.add()
does nothing to push your object to the database and generate the id. You
need to execute session.flush() after session.add() to write the book to the
database and generate the id. After the flush() operation, the book id
Thanks for the quick response. However, the problem I face is not
being able to access the id assigned by database but not being able to
modify the corresponding field in Page instance. To be more clear:
bk_ids = {}
for title in ('Tom Sawyer', 'Huck Finn'):
book = Book(title=title)
Using your class definitions, it seems to work. What is different?
Base.metadata.bind=create_engine('sqlite:///')
Base.metadata.create_all()
session=sessionmaker()()
bk_ids = {}
for title in ('Tom Sawyer', 'Huck Finn'):
book = Book(title=title)
session.add(book)
session.flush()
Actually I hadn't realized that the problem only occurred on eagerloading.
Would it make sense to be able to do an alias at the table level? In
other words:
task_parent=aliased(task_table)
mapper(Task,task_table, properties={
'Children' : relation(Task, backref=backref('Parent',
It does indeed! It is my bad, it works as expected, the problem was
due to not flushing properly before storing the values in the
dictionary.
Sorry for the inconvenience and thank you for the support.
On Nov 9, 4:46 pm, Mike Conley mconl...@gmail.com wrote:
Using your class definitions, it
how can i use having?
example:
targets = meta.Session.query(ObjetoCusto.objeto_custo_id,
ObjetoCusto.descricao).\
join(TipoObjeto).\
join(EtapaObjeto).\
filter(EtapaObjeto.ano_id == c.year).\
On Nov 9, 2009, at 1:09 PM, David Gardner wrote:
Actually I hadn't realized that the problem only occurred on
eagerloading.
Would it make sense to be able to do an alias at the table level? In
other words:
task_parent=aliased(task_table)
mapper(Task,task_table, properties={
Thanks for looking into this, just as an fyi this isn't effecting any
production code for me,
I still have the option of implementing parent/children using an integer
id's column.
Michael Bayer wrote:
at that level. you'd at least want to use a table alias, i.e.
task_table.alias() - but
we are looking at feburary at the latest, hopefully.
On Nov 9, 2009, at 5:14 AM, 诚子 wrote:
RT,
i'm using it now,
i want it's out when
i product is online.
--
my.unix-center.net/~WeiZhicheng
--~--~-~--~~~---~--~~
You received this message because you
On Nov 8, 2009, at 5:06 PM, M3nt0r3 wrote:
Hi , i am sorry for my english, i am trying ti make a Server/Client
app. Until now client-gtk mapped the db and spoked directly with the
db ( sqlite and postgresql atm) . I wrote a small wsgi server based
on werkzeug, and it basically make the
13 matches
Mail list logo