Lukasz Szybalski ha scritto:
I am trying to insert a record with a compound primary key that consists of
Team_Sid, User_Sid
I can either do
i = users_table.insert()
i.execute(TEAM_SID=343, USER_SID=1,TEAM_NAME='the team')
i.execute(TEAM_SID=343, USER_SID=2,TEAM_NAME='the team')
On Sat, 2007-09-08 at 10:40 +0200, Marco Mariani wrote:
Your post begs for a question, which is why? :-)
You are fighthing the system. Having an autonumber column as part of
a
compound key does not make a lot of sense.
I don't think you have a really, really, really strange use case that
My need is related to Postgresql ON DELETE RESTRICT/NO ACTION : I'd
want a sql exception as soon as a parent having any existing child is
deleted. I don't want cascade delete on children, just the parent but
only if it has no child.
I've remarked that SA (0.4) first SET NULL all FKs in child
On Sep 8, 11:21 am, Andreas Jung [EMAIL PROTECTED] wrote:
http://www.sqlalchemy.org/docs/04/sqlexpression.html#sql_update
Of course I know about that. But I'm using the ORM. I was asking if it
was possible to do that through the ORM API instead of fall[ing] back
onto the
plain SQL API, mainly
On Sep 8, 2007, at 12:54 PM, Jean-Philippe Dutreve wrote:
My need is related to Postgresql ON DELETE RESTRICT/NO ACTION : I'd
want a sql exception as soon as a parent having any existing child is
deleted. I don't want cascade delete on children, just the parent but
only if it has no child.
I don't know if SQLAlchemy has an easy way of determining this metadata, but
you can likely query the system tables directly. pg_attrdef stores this
information in the adbin/adsrc columns. You can parse the adsrc column to
get the sequence name. You can filter your query easily by table and/or
Thanks for the tip!
I solved it this way now and it works pretty well.
if True in [c.primary_key for c in tableName.c]:
sequenceName = '%s_id_seq' % tableName
Koen
On Sep 9, 12:52 am, Orest Kozyar [EMAIL PROTECTED] wrote:
I don't know if SQLAlchemy has an easy way of determining this