Hi all,
I am just starting to think about this topic so please dont shoot me
if I missed the obvious :).
There are many varieties of database errors. So, sometimes in our
code, we need to let these errors be returned to the user. E.g. we
would like a french guy using this application to have a
I have 2 tables 'Product' and 'ProductPrice'. I want to get all valid
products, a product is valid if it has both a valid 'Selling' and 'Buying'
ProductPrice type. A ProductPrice is valid if the valid_from date =
date.today() and valid_to = date.today().
Product Table:
id | sku | principal
For certain orm queries with a 1-to-many relation i want to left outer
join and then update the on-clause for that relation. Since the
criteria changes between queries I cannot fix the join criteria when
specifying my object/table mappings.
For example:
tables: user, email
relation:
I have a simple foreign key relationship between a Task class and a
Context class, where many Tasks can have the same Context. The
default value for the Task foreign key context_id is 0. When I delete
a Context, the Tasks with that context have their context_id
automatically set to None and I
On 11 Sep., 22:12, Conor conor.edward.da...@gmail.com wrote:
This query will get you close to your desired SQL:
q = session.query(ATable)
q = q.filter(
sa.exists(
[1],
((BTable.atable_id == ATable.id)
(CTable.cval.in_([foo, bar]))),
':
metadata.create_all(db_engine)
s=sessionmaker(bind=db_engine)()
try:
john = Person('John')
peter = Employee('Peter', 'clerk')
jack = Employee('Jack', 'manager')
m1 = Meeting('20090914', peter, john)
m2 = Meeting('20090915', peter, jack
Hi,
I plan to use the migrate.versioning.api to manage the versions of the
tables.
But there are different repositories belonging to the modules of my
project.
Each module has its own repository but will refer to the tables of
other modules. Is it possible?
I have 2 different repositories: say
Hello SQLAlchemy Group,
I've been trying to work out a way I can get the data from a table
whose columns are primary keys.
The challenge is, I don't know before hand which columns are primary
keys since the code is to be run on different tables.
I've figured out how to get the primary keys
=db_engine)()
john = Employee('John', 'person')
peter = Employee('Peter', 'clerk')
jack = Employee('Jack', 'manager')
m1 = Meeting('20090914', peter, john)
m2 = Meeting('20090915', peter, jack)
s.add_all([john, peter, jack, m1, m2])
s.commit()
#We now want to print
If I understand this, you want to construct a query that returns the primary
keys in an arbitrary table?
Try this:
key_cols = [c for c in table.primary_key.columns]
session.query(*key_cols).all()
--~--~-~--~~~---~--~~
You received this message because you are
=db_engine)()
try:
john = Person('John')
peter = Employee('Peter', 'clerk')
jack = Employee('Jack', 'manager')
m1 = Meeting('20090914', peter, john)
m2 = Meeting('20090915', peter, jack)
s.add_all([john, peter, jack, m1, m2
:
john = Person('John')
peter = Employee('Peter', 'clerk')
jack = Employee('Jack', 'manager')
m1 = Meeting('20090914', peter, john)
m2 = Meeting('20090915', peter, jack)
s.add_all([john, peter, jack, m1, m2])
s.commit
I have 2 tables 'Product' and 'ProductPrice'. I want to get all valid
products, a product is valid if it has both a valid 'Selling' and 'Buying'
ProductPrice type. A ProductPrice is valid if the valid_from date =
date.today() and valid_to = date.today().
Product Table:
id | sku | principal
I want to abstract some ugly reporting SQL strings into a read-only
object model. I have created an empty class, and then I map it to a
select object that pulls some statistical information from the DB.
The mapper is complaining that it can't assemble a primary key. I am
only using this object
Steve Zatz wrote:
I have a simple foreign key relationship between a Task class and a
Context class, where many Tasks can have the same Context. The
default value for the Task foreign key context_id is 0. When I delete
a Context, the Tasks with that context have their context_id
me wrote:
For certain orm queries with a 1-to-many relation i want to left outer
join and then update the on-clause for that relation. Since the
criteria changes between queries I cannot fix the join criteria when
specifying my object/table mappings.
For example:
tables: user, email
gizli wrote:
From my understanding, some databases like MySQL does not support
setting language for a particular DB session. Some others, such as
Oracle, allows this. Is this ever considered in SA?
If you are looking for an application wide setting, there is an open-ended
API bywhich you
Paulo Aquino wrote:
I have 2 tables 'Product' and 'ProductPrice'. I want to get all valid
products, a product is valid if it has both a valid 'Selling' and 'Buying'
ProductPrice type. A ProductPrice is valid if the valid_from date =
date.today() and valid_to = date.today().
Product Table:
Suha Onay wrote:
Hi,
I plan to use the migrate.versioning.api to manage the versions of the
tables.
But there are different repositories belonging to the modules of my
project.
Each module has its own repository but will refer to the tables of
other modules. Is it possible?
I have 2
Bryan wrote:
I want to abstract some ugly reporting SQL strings into a read-only
object model. I have created an empty class, and then I map it to a
select object that pulls some statistical information from the DB.
The mapper is complaining that it can't assemble a primary key. I am
only
Michael,
Michael Bayer mike...@zzzcomputing.com schrieb:
On Sep 13, 2009, at 7:01 AM, Christoph Böhme wrote:
Hi all,
I wonder if it is possible to reflect tables in a Postgres/PostGIS
database with geoalchemy 0.1. The geoalchemy documentation only
mentions delarative model
if you're using foreign keys correctly, that would imply there's an entity
with an id of 0, and you'd attach that Context to each Task, replacing
the old Context to be deleted.
Michael, thanks for the usual thorough response. Yes, there is a
Context entity with a unique (non-primary) id of
22 matches
Mail list logo