a...@svilendobrev.com wrote:
use the relation as a join path, and then whatever
filtering/ordering
try:
unit.join(Unit.records).order_by(Record.date.desc()).first()
or
unit.join('records').order_by(Record.date.desc()).first()
That gives me:
AttributeError: 'Unit' object has no
ah, it has to be other way around
unit = session.query(Unit).filter(Unit.id==3).first()
rec = sess.query( Record).filter( Record.theunit == unit)...
where theuint is the backref of Unit.records.
see
http://www.sqlalchemy.org/docs/05/ormtutorial.html#common-relation-operators
or just wait for
a...@svilendobrev.com wrote:
rec = sess.query( Record).filter( Record.theunit == unit)...
Is this as nice as I can get it or is their a slicker solution?
or just wait for Mike (-:)
Hopefully Mr Bayer can enlighten me :-)
Chris
--
Simplistix - Content Management, Zope Python Consulting
On Friday 13 February 2009 11:02:13 Chris Withers wrote:
a...@svilendobrev.com wrote:
rec = sess.query( Record).filter( Record.theunit == unit)...
Is this as nice as I can get it or is their a slicker solution?
this might work too
rec = sess.query( Record).filter_by( theunit = unit)...
On Friday 13 February 2009 11:07:29 koranthala wrote:
Hi,
I am working on a Python application which does approximately
1000 updates at a time every 3 seconds in a Sqlite File Database
using SqlAlchemy. On timing it in a 2GHz machine, I found that it
is taking ~1.01 seconds to do the
On Feb 13, 2:11 pm, a...@svilendobrev.com wrote:
On Friday 13 February 2009 11:07:29 koranthala wrote:
Hi,
I am working on a Python application which does approximately
1000 updates at a time every 3 seconds in a Sqlite File Database
using SqlAlchemy. On timing it in a 2GHz
The inserts I do is as follows:
BEGIN:
2009-02-13 14:34:40,703 INFO
sqlalchemy.engine.base.Engine.0x..10 UPDATE data SET status=?
WHERE data.index = ?
2009-02-13 14:34:40,703 INFO
sqlalchemy.engine.base.Engine.0x..10 ['True', 68762]
...
(1000)
...
COMMIT
Some more testing...
- Note, I'm just trying to get the joins working before using the queries with
session etc
m = db.devmap_manufacturer
d = db.devmap_device
d.join(m).first()
MappedDevmap_device(id=1,device_name='otc701',manufacturer_id=1)
m = db.with_labels(db.devmap_manufacturer)
d
Using an update query with synchronize_session=False will generate a
single SQL statement that will be as efficient as possible.
Look at this example
http://stackoverflow.com/questions/270879/efficiently-updating-database-using-sqlalchemy-orm/270942
and docs
Hi,
On Fri, Feb 13, 2009 at 7:26 AM, MikeCo mconl...@gmail.com wrote:
The ORM will probably have a little bit of function call overhead compared
to the SQL Expression Language, and that may no longer be the case.
Regardless with the ORM you're going to want to use the update method as
stated by
Hi,
Using sql alchemy with pylons I get warnings like this:
C:\Python26\lib\site-packages\sqlalchemy-0.5.3dev-py2.6.egg\sqlalchemy
\orm\scoping.py:121: SADeprec
ationWarning: Use session.add()
return getattr(self.registry(), name)(*args, **kwargs)
I know that its caused by deprecation of
On Feb 12, 2009, at 6:42 PM, Chris Withers wrote:
Hi All,
With the model from my previous post, I'm looking to find the latest
Record for a particular Unit.
Someone on #sqlalchemy suggested this:
unit = session.query(Unit).filter(Unit.id==3).first()
record =
On Feb 13, 2009, at 4:07 AM, koranthala wrote:
Hi,
I am working on a Python application which does approximately 1000
updates at a time every 3 seconds in a Sqlite File Database using
SqlAlchemy. On timing it in a 2GHz machine, I found that it is taking
~1.01 seconds to do the same.
use the warnings filter described in the Python library documentation
to configure the behavior of warnings.
On Feb 13, 2009, at 4:42 AM, przemek.ch wrote:
Hi,
Using sql alchemy with pylons I get warnings like this:
C:\Python26\lib\site-packages\sqlalchemy-0.5.3dev-py2.6.egg\sqlalchemy
which two tables are concrete ? I dont see the concrete=True
keyword used in your mapping setup, but then again I don't see the
inherits keyword either, so the usage of polymorphic_identity/
polymorphic_on is useless here. you'd just configure Node and
Product mappers completely
On Feb 13, 2009, at 10:08 AM, Michael Bayer wrote:
On Feb 13, 2009, at 4:07 AM, koranthala wrote:
Hi,
I am working on a Python application which does approximately 1000
updates at a time every 3 seconds in a Sqlite File Database using
SqlAlchemy. On timing it in a 2GHz machine, I
I get an error when I'm trying tu run this:
stmt = text(select * from salary_data_new
where codeword=:codeword union
select * from salary_data_clean where codeword=:codeword
)
# s is instance of Session() class factory
i guess s.execute(stmt, params=dict(codeword=codeword) )
}On Friday 13 February 2009 18:42:26 Max Ischenko wrote:
I get an error when I'm trying tu run this:
stmt = text(select * from salary_data_new
where codeword=:codeword union
select * from
Hello!
In a configuration looking like this:
class Parent:
pass
class Child(Parent):
pass
class ChildChild(Child):
pass
I would like to query the Childs and all classes that inherits it
(here: ChildChild), but not Parent instances.
session.query(Child).all() returns Child type only (
session.query(Child).filter( Child.type != 'childtypenamehere') ?
On Friday 13 February 2009 19:05:52 GustaV wrote:
Hello!
In a configuration looking like this:
class Parent:
pass
class Child(Parent):
pass
class ChildChild(Child):
pass
I would like to query the Childs and
ah sorry, singleinh, ignore my post
On Friday 13 February 2009 19:05:52 GustaV wrote:
Hello!
In a configuration looking like this:
class Parent:
pass
class Child(Parent):
pass
class ChildChild(Child):
pass
I would like to query the Childs and all classes that inherits it
On Feb 13, 8:20 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Feb 13, 2009, at 10:08 AM, Michael Bayer wrote:
On Feb 13, 2009, at 4:07 AM, koranthala wrote:
Hi,
I am working on a Python application which does approximately 1000
updates at a time every 3 seconds in a
I started implementing this and it seemed a bit pointless because it
just moves logic from one method (reflecttable) to several
(reflect_columns, refelct_primary_keys, etc) without much benefit. The
only immediate benefit I can see is that it may eliminate some
redundancy. For example,
sorry I havent had the time to comment. though the resolution seems
reasonable.
On Feb 13, 2009, at 1:29 PM, Randall Smith wrote:
I started implementing this and it seemed a bit pointless because it
just moves logic from one method (reflecttable) to several
(reflect_columns,
Hi, all.
I'm trying to get a many-to-many relationship, where each side of that
relationship is the same table, and where there's an association
object between them to hold data about the particular relationship.
I'm using SQLAlchemy 0.5rc4.
From the examples on the documentation, and some
On Feb 13, 2009, at 1:46 PM, Stephen Hansen wrote:
Hi, all.
I'm trying to get a many-to-many relationship, where each side of that
relationship is the same table, and where there's an association
object between them to hold data about the particular relationship.
I'm using SQLAlchemy
The first step would be to configure the inheritance hiearchy of
Things, as I see you have an Asset table in there as well which I'm
assuming is a Thing subclass. The joined table inheritance section
in the docs will explain that. then you just set up relations using
the same techniques
Michael Bayer wrote:
session
.query(Record).with_parent(unit).order_by(Record.date.desc()).first()
OK, this works...
alternatively, to do exactly what you stated above, i.e.
unit.records.order_by()... etc., you can use a dynamic relation
which establishes relations as Query objects.
On Feb 13, 2009, at 2:09 PM, Stephen Hansen wrote:
The first step would be to configure the inheritance hiearchy of
Things, as I see you have an Asset table in there as well which I'm
assuming is a Thing subclass. The joined table inheritance section
in the docs will explain that. then
On Feb 13, 2009, at 2:12 PM, Chris Withers wrote:
Michael Bayer wrote:
session
.query(Record).with_parent(unit).order_by(Record.date.desc()).first()
OK, this works...
alternatively, to do exactly what you stated above, i.e.
unit.records.order_by()... etc., you can use a dynamic
On Feb 13, 2009, at 12:05 PM, GustaV wrote:
Hello!
In a configuration looking like this:
class Parent:
pass
class Child(Parent):
pass
class ChildChild(Child):
pass
I would like to query the Childs and all classes that inherits it
(here: ChildChild), but not Parent
31 matches
Mail list logo