Well, it appears I have answered my own question and, yes, it was a
SQLAlchemy issue. I resolved the problem by explicitly compiling the
mapping at the end of the model initialization:
manager_mapper = orm.mapper(Manager, manager_table, ... etc.
... (all other dependent mappers)
rootsmith wrote:
Well, it appears I have answered my own question and, yes, it was a
SQLAlchemy issue. I resolved the problem by explicitly compiling the
mapping at the end of the model initialization:
manager_mapper = orm.mapper(Manager, manager_table, ... etc.
... (all other dependent
Hi All!
Why I get at SET part not only items from values(...), but all from
params passed to session.execute?
transactions_update =
model.transactions_table.update().where(and_(model.transactions_table.c.commit_date==bindparam('commit_date'),
sector119 wrote:
Hi All!
Why I get at SET part not only items from values(...), but all from
params passed to session.execute?
transactions_update =
model.transactions_table.update().where(and_(model.transactions_table.c.commit_date==bindparam('commit_date'),
though likely cleaner to pass the exact set of parameters desired.
How to pass that params if I use bindparam at where() and values(),
but I don't want to update colums that are at where() clause, only at
values() ?
--~--~-~--~~~---~--~~
You received this message
sector119 wrote:
though likely cleaner to pass the exact set of parameters desired.
How to pass that params if I use bindparam at where() and values(),
but I don't want to update colums that are at where() clause, only at
values() ?
if you are using bindparam() objects, you'd given them
you'd need to establish the primary key from the mapper's point of
view in terms of both userId and userName. mapper() accepts a
primary_key argument for this purpose.
That kind of surprises me sqlalchemy isn't aware of what's a primary
key and what isn't. Looking at the docs, it states
Josh Stratton wrote:
I've tried this and
primary_key=[usersTable.c.userId] and all the attributes contributing
to the primary key and still see IntegrityErrors when inserting into
the users table.
class 'sqlalchemy.exceptions.IntegrityError': (IntegrityError)
column userName is not unique
Thanks for the compile_mappers() call - that is a lot easier than
calling compile() on all the individual mappers.
What is very strange is that I can see at the point of my first
calling on the object from the beaker session, I retrieve it and merge
it successfully into the SQLAlchemy Session.
I'm considering using the SA SQL expression facility in a Twisted
server, replacing some SQL creation code that's vulnerable to SQL
injection attacks.
Doing some exploration on the intersection of Twisted and SA, I came
across a message by David Bolen in February of 2007, describing a
simple
I've started playing somewhat seriously with the SQL expression subset
of SA as a replacement for some direct SQL code (and as a possible first
step to heavier use of SA). As part of this, I took a query containing
several selects, which naturally returns several result sets. In my
current
Something strange, Michael.. All bindparams are different. Compliller
should not add to SET all params if values() has bindparam args, no?
where() have:
bindparam('commit_date'), bindparam('serial'), bindparam
('office_id')
values() have:
bindparam('rollback_date'),
Don Dwiggins wrote:
I've started playing somewhat seriously with the SQL expression subset
of SA as a replacement for some direct SQL code (and as a possible first
step to heavier use of SA). As part of this, I took a query containing
several selects, which naturally returns several result
sector119 wrote:
Something strange, Michael.. All bindparams are different. Compliller
should not add to SET all params if values() has bindparam args, no?
where() have:
bindparam('commit_date'), bindparam('serial'), bindparam
('office_id')
values() have:
Don Dwiggins d...@dondwiggins.net writes:
Doing some exploration on the intersection of Twisted and SA, I came
across a message by David Bolen in February of 2007, describing a
simple database class that contained a background thread for
execution. I'd like to know if that work, or some
OK, you have the unique constraint on userName alone. that means that you
*cannot* have two rows like this:
userId userName
1 someuser
2 someuser
Right.
because unlike a primary key that consists of userId and userName, the
distinctness here of userName is
Josh Stratton wrote:
Maybe my setup isn't correct, but if I do something like this:
session.add(myObj)
session.flush()
# try adding to the database here
# check if it's in there
matches = [obj for obj in
Is there any way to customize the mapper-generated queries used for
persisting objects? My specific case is that I would like to have the
ORM call a stored procedure for inserts and updates rather than the
usual insert and update statements.
Thanks,
Ian
Ian wrote:
Is there any way to customize the mapper-generated queries used for
persisting objects? My specific case is that I would like to have the
ORM call a stored procedure for inserts and updates rather than the
usual insert and update statements.
in a way that is transparent within
David, thanks for the quick reply.
Well, the server using it, in a slightly modified version from that
message, remains in production, and has been continuously since July
of 2007. So it's certainly worked for its intended purpose for me -
that is, offloading the SA database I/O to a
On Oct 22, 2009, at 6:33 PM, jeff wrote:
I would like to allow user's to save favorite queries in my Python
app. Is there a way to find out the SQL statement as a string that
can be then reused (e.g. Engine.execute(text(savedQueryText) ) )?
Or is there another solution to this need?
On Oct 22, 2009, at 3:26 PM, sector119 wrote:
Something strange, Michael.. All bindparams are different. Compliller
should not add to SET all params if values() has bindparam args, no?
where() have:
bindparam('commit_date'), bindparam('serial'), bindparam
('office_id')
values() have:
22 matches
Mail list logo