Hi,
I am just starting to use the relation between two tables.
The problem started with the child data not being written to the child
tables.
I played around, and now I am totally confused.
Maybe someone can shed some light on this.
I got these tables:
{{{
user_table = sa.Table('User',
Dear all,
I've a situation where some tutors has some doctorates. Each doctorate
has to upload some reports. Each tutor has to approve reports of his
doctorates.
These are the tables and mappers:
members_table = Table('members', metadata,
Column('id', types.Integer, primary_key=True),
For the moment I solved using these query:
doctorate = Session.query(Members).filter(and_(Members.removed==False,
Members.tutor.has(id=tutor_id))).subquery()
reports = Session.query(Reports, doctorate.c.id).outerjoin((doctorate,
Reports.writer==doctorate.c.id)).order_by(Reports.id).all()
# Only
Hi List,
ok, i figured it out. My understanding of the documentation was a bit
different.
I really worked out this way. But
Thekey in the properties is the attribute name, that will be added to
the parent object.
So doing this
orm.mapper(User, user_table, properties={
Hi,
I have this subquery, which yields results
sp_HeaderDetails =
session.query( InvoiceCashFlowPerDocNum.sequence_id,
InvoiceHeaderInfo.invoice_ref, InvoiceHeaderInfo.doc_num ) \
.filter( ( InvoiceCashFlowPerDocNum.doc_num ==
InvoiceHeaderInfo.doc_num ) ) \
On Jan 26, 2011, at 11:46 AM, Pankaj wrote:
Hi,
I have this subquery, which yields results
sp_HeaderDetails =
session.query( InvoiceCashFlowPerDocNum.sequence_id,
InvoiceHeaderInfo.invoice_ref, InvoiceHeaderInfo.doc_num ) \
.filter( (
I'm currently interfacing with an Oracle db using sqlalchemy without
any sessions or mappings. Selects and inserts work great, but I'd
like to be able to update a row without having to delete and reinsert
it.
# remove the id
table.delete(table.c.id == row['id']).execute()
the docs for update() are at:
tutorial: http://www.sqlalchemy.org/docs/core/tutorial.html#inserts-and-updates
API:
http://www.sqlalchemy.org/docs/core/expression_api.html#sqlalchemy.sql.expression.update
On Jan 26, 2011, at 2:14 PM, Josh Stratton wrote:
I'm currently interfacing with an
Hello,
While working on a database test with nose, I dug into sqlalchemy 0.6.6 until I
found these lines:
class DDLElement(expression.Executable, expression.ClauseElement):
Base class for DDL expression constructs.
_execution_options = expression.Executable.\
On Jan 26, 2011, at 5:16 PM, A.M. wrote:
Hello,
While working on a database test with nose, I dug into sqlalchemy 0.6.6 until
I found these lines:
class DDLElement(expression.Executable, expression.ClauseElement):
Base class for DDL expression constructs.
_execution_options =
On Jan 26, 2011, at 5:45 PM, Michael Bayer wrote:
From this it follows that if you'd like to emit several DDL statements in a
transaction, the usage is no different for DDL expressions than for any other
kind of DML statement (i.e insert/update/delete). Use
Well, I spoke too soon :( What is the mistake in the following sample code
which causes the COMMITs to be emitted? Setting autocommit to either True or
False emits the same SQL. I think this is a case of staring at the same code
too long causing brain damage- thanks for your patience and help!
On Jan 26, 2011, at 6:10 PM, A.M. wrote:
Thanks for the prodding- I figured out my bug. Here is sample code that
demonstrates a little surprise.
First, this code that emits:
BEGIN (implicit)
SELECT 1
ROLLBACK
=
from sqlalchemy.engine import create_engine
On Jan 26, 2011, at 6:32 PM, A.M. wrote:
Well, I spoke too soon :( What is the mistake in the following sample code
which causes the COMMITs to be emitted? Setting autocommit to either True or
False emits the same SQL. I think this is a case of staring at the same code
too long causing
Is it possible to make a generalized declarative mixin class that
abstracts away all of the syntax of inheritance? I've seen examples
that set up the __mapper_args__ but not the discriminator column, and
examples that set up the discriminator column but not the
__mapper_args__, but none with both.
well it will work if you say this:
class PolymorphicMixin(object):
discriminator = Column('discriminator', types.String(50))
@declared_attr
def __mapper_args__(cls):
ret = {'polymorphic_identity': cls.__name__}
if Base in cls.__bases__:
Is there something similar to the .get() method in SqlSoup and Session
but which allows me to fetch more than one object by ID, so as to save
on round trips to the DB? (This could be done by composing using the
IN operator in SQL.) Thanks in advance.
--
Yang Zhang
http://yz.mit.edu/
--
You
On Wed, Jan 26, 2011 at 8:17 PM, Yang Zhang yanghates...@gmail.com wrote:
Is there something similar to the .get() method in SqlSoup and Session
but which allows me to fetch more than one object by ID, so as to save
on round trips to the DB? (This could be done by composing using the
IN
18 matches
Mail list logo