Hi All,
I have a few queries regarding SQLAlchemy.
I have a pre existing mysl database and I wanted to use SQLAlchemy on
it so I have used SQLSoup to connect to the existing database.
• How to close the connection once the query is done as apps become
slow after a few hits to the database
Thanks!
Great work! :)
On Sat, Jan 21, 2012 at 3:18 AM, Conor conor.edward.da...@gmail.com wrote:
def get_constraint_name(e):
# Unique constraint violations in PostgreSQL have error code 23505.
if e.orig.pgcode == 23505:
return re.search(r'^ERROR: duplicate key value violates
hello friends,
i'm using sa at a quite low level, with session.execute(text, dict)
is it possible to do something in the spirit of:
session.execute(select * from tablename where id in (:ids),
dict(ids=[1,2,3,4])) ?
thanks in advance,
alex
--
You received this message because you are
*
http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.session.Session.close
* Not too sure if there is a pre-written or easy way to do caching, or if
you'd have to write it yourself.
-Original Message-
From: sqlalchemy@googlegroups.com
I have a certain ORM model that is being referenced from several other models.
I don't want the user to be able to delete rows from that table that are still
being referenced elsewhere.
Ideally I would like something like:
refs = get_references(row)
if refs:
print Can't delete
So I figured out that I can do this:
try:
self.session.delete(row)
self.session.flush()
except sqlalchemy.exc.IntegrityError:
print Can't do that!
But that really isn't a lot of help, because I'm now stuck with a useless
transaction. If the user makes a bunch of
On Jan 22, 2012, at 7:50 PM, Jackson, Cameron wrote:
I have a certain ORM model that is being referenced from several other
models. I don't want the user to be able to delete rows from that table that
are still being referenced elsewhere.
Ideally I would like something like:
refs =
On Jan 22, 2012, at 8:21 PM, Jackson, Cameron wrote:
So I figured out that I can do this:
try:
self.session.delete(row)
self.session.flush()
except sqlalchemy.exc.IntegrityError:
print Can't do that!
But that really isn't a lot of help, because I'm now stuck
Yes, this is so a 'Delete' button can return a list of references that need to
be broken before the row can be deleted. I don't want cascades in this case, as
there is too much potential for the user to blow away hours of data entry with
a single deletion.
Yeah, I fully expect that what I'm
On 2012-1-23 03:23, Jackson, Cameron wrote:
Anyway, it kind of looks to me like any attempt to do this in some sort
of clever automatic way is going to be more trouble than its worth, so I
think I'll just bite the bullet and put backrefs on all of the
relationships that are going to the table in
10 matches
Mail list logo