Cheers, both of these worked.
On Mar 31, 5:19 pm, Michael Bayer mike...@zzzcomputing.com wrote:
oh, you could send that as a tuple to join, i.e.
db.devmap_device.join((db.devmap_manufacturer,
db.devmap_device.manufacturer_id == db.devmap_manufacturer.id)).first()
this because join()
Hi all,
I am facing a strange problem . sometimes when i try to
access my web server i get Invalid Transaction error. Can anyone
help me in this regard
The error description :
Traceback (most recent call last):
File c:\python25\lib\site-packages\cherrypy-2.2.1-py2.5.egg\cherrypy
Hi,
I have to write a table comparator.
Actually, I have 2 sqlite files (file1.db, file2.db) with the same
schema (2 tables tab1, tab2).
I d like to compare the values of the tables (values added, values
deleted, values modified).
I don't know how to start.
Can someone help me?
Thanks in
I'm having another go at converting some sql to sqlalchemy:
select
count(distinct build.device_id)
from
channelbuild
join
build
on
build.id = channelbuild.build_id
where
channelbuild.channel_id = 9
Hi all,
I want to know if I am using SQLAlchemy in a correct and proper way for Many
to One Relations between objects and database tables. I have created a test
case for Cars and Brands. Each car can have a name and one Brand. I wonder if
I use the setter in the Car Class correctly and if the
Stu.Axon wrote:
I'm having another go at converting some sql to sqlalchemy:
select
count(distinct build.device_id)
from
channelbuild
join
build
on
build.id = channelbuild.build_id
where
Jyotirmoy wrote:
I want to know what is the best way to write code using sqlalchemy
that given a value of the primary key inserts a record if no record
with that key exists or updates the value of the other columns if the
key already exists.
I wrote a naive version which get()s the value
its almost an example fit for a tutorial. I'd just lose the setBrand()
method and just assign car.brand = somebrand. the brand_id gets
populated by the ORM when things are flushed.
Frank Broniewski wrote:
Hi all,
I want to know if I am using SQLAlchemy in a correct and proper way for
see my comments on the ticket for further discussion.
Catherine Devlin wrote:
Hey, SQLAlchemy folks... sorry to bug you during your sprint (wish I could
be there - next year, I hope), but I've got a patch for you that I hope
will
be really quick and easy to review and apply. I've attached
I have a nested set implementation that I am working on. Currently,
the steps involved to make a change to the table are:
1) Retrieve parent node (ORM Object)
2) Create new node (same ORM object as #1)
3) Calculate UPDATE boundaries, etc. from anchor node
4) Create UPDATE SQL based on #3
5)
What I would do is simply iterate through the list of id's the user
gives. Then use sess.query(SomeClass).get(id) to retrieve the
required instance, apply changes if needed and loop to the next id.
Then issue sess.commit() at the end.
SA will take care of either updating things from the db,
I tried this
session\
.query(func.count(distinct(build.device_id)))\
.filter(channelbuild.channel_id == 9)\
.filter(build.in_icp == False)\
.scalar()
It generated this sql:
SELECT
count(DISTINCT backfill_build.device_id)
AS
count_1
FROM
backfill_build,
there's a nested set demo in the examples/ folder of the distribution,
which uses MapperExtension as well as a little-used flag on the mapper
called batch=False. are you building off of that ? as far as
multithread/process, the UPDATE statements which nested sets requires
would result in a
Stu.Axon wrote:
I tried this
session\
.query(func.count(distinct(build.device_id)))\
.filter(channelbuild.channel_id == 9)\
.filter(build.in_icp == False)\
.scalar()
It generated this sql:
SELECT
count(DISTINCT backfill_build.device_id)
AS
count_1
FROM
Hi,
I need to generate a sqlalchemy.sql.expression._BinaryExpression by
hand. So I looked into the docu and found that I need a left, right
and a operator. I am stuck at the left :) type() says it is a
sqlalchemy.sql.util.AnnotatedColumn. But I can't find the class
definition anywhere in
Hinrich Winther wrote:
Hi,
I need to generate a sqlalchemy.sql.expression._BinaryExpression by
hand. So I looked into the docu and found that I need a left, right
and a operator. I am stuck at the left :) type() says it is a
sqlalchemy.sql.util.AnnotatedColumn. But I can't find the class
Doh, must be tired. That works cool... finally have my first
SQLAlchemy ORM stuff working. Thanks...
Is it best practice to move the joins into the filter(where) clause
like this, (in this case channelbuild.build_id is FK to the PK
build.id)?
I tried putting the join inside the distinct
You may prefer to use session.merge() leaving the SELECT and the
subsequent decision to INSERT or UPDATE to SQLAlchemy (see
http://www.sqlalchemy.org/docs/05/session.html?highlight=merge#merging)
The main section of your example should look like this then:
---snip---
id =
Hi,
I'm currently trying to port a Django based application using sqlalchemy
and I'm a bit confused with some Django's orm features I'm not able to
find in sqlalchemy.
To avoid triggers I used to redefine the save() and delete() methods
from Django's models to be able to update some other
look into using MapperExtension and/or SessionExtension to add hooks
within the flush process.
Laurent Rahuel wrote:
Hi,
I'm currently trying to port a Django based application using sqlalchemy
and I'm a bit confused with some Django's orm features I'm not able to
find in sqlalchemy.
To
Maybe there is a better way of doing it. To be exact:
I want to disassemble a given _BinaryExpression into basic elements (a
list of strings, arrays, integers ...) and reassemble it somewhere
else out of this basic elements.
On 01.04.2009, at 18:14, Michael Bayer wrote:
Hinrich
well its part of a traversable expression tree, its just left, right and
op, if you want generic traversal take a look at the sql.visitors module.
Hinrich Winther wrote:
Maybe there is a better way of doing it. To be exact:
I want to disassemble a given _BinaryExpression into basic elements
i.e. the operator is a function:
my_binary = column('foo') == column('bar')
my_new_binary = my_binary.operator(my_binary.left, my_binary.right)
make sense ?
Hinrich Winther wrote:
Maybe there is a better way of doing it. To be exact:
I want to disassemble a given _BinaryExpression into
i have similar thing, but by keeping an expression in my own terms and
rendering into different things, like text, SQL, SA-expresion, etc.
u define what is a variable, const, functor, overload all the
operators, etc etc; then have a visitor that walks and translates
(interprets) it into
u have MapperExtensions, per class, and u have SessionExtension, per
session. Both exhibit various events, in different life-span points.
i think there are some decorators for declarative...
On Wednesday 01 April 2009 19:26:35 Laurent Rahuel wrote:
Hi,
I'm currently trying to port a Django
The PGUuid doesn't accept Python's uuid.UUID type. Here's a simple patch
to fix that:
diff --git
a/lib/python2.5/site-packages/SQLAlchemy-0.5.3-py2.5.egg/sqlalchemy/databases/po
index 038a9e8..394c293 100755
---
I think we should put this in 0.6 since 0.5.3 is already out with the
non-UUID version, code that expects a string to be returned will break.
Im using a TypeDecorator myself to integrate with UUID at the moment.
class GUIDType(TypeDecorator):
impl = PGUuid
def process_bind_param(self,
I am getting a new error with 0.5.3, I've tried to work around it but
can't seem to find the
right magic.
Can't determine relation direction for relationship 'Taggable.owner' -
foreign key columns are present in both the parent and the child's
mapped tables. Specify 'foreign_keys' argument.
An
Michael,
Thanks for your reply.
On Apr 1, 11:46 am, Michael Bayer mike...@zzzcomputing.com wrote:
there's a nested set demo in the examples/ folder of the distribution,
which uses MapperExtension as well as a little-used flag on the mapper
called batch=False. are you building off of that ?
On Apr 1, 9:22 pm, Yassen Damyanov yassen@gmail.com wrote:
Jyotirmoy wrote:
I want to know what is the best way to write code using sqlalchemy
that given a value of the primary key inserts a record if no record
with that key exists or updates the value of the other columns if the
key
30 matches
Mail list logo