Hi,I can't use transaction with class Insert()/Update,someone can help
me ?thanks!
When i run Insert().execute() then will auto commit the transaction,I
don't want it auto commit...
code
import sqlalchemy as sa
from sqlalchemy import MetaData
from
Hi,
Can I have identical column names in both parent and child classes
that are part of a joined-table inheritance? These are simply created,
created_by, modified, modified_by columns that are populated by
defaults defined for them (ie. default, server_default, onupdate).
The values are written
Looks like you are trying to mix ORM and SQL expression constructs.
Also, Insert() objects should be constructed via the insert() function.
Try this
conn = session.connection() # get handle to the session's connection
t = conn.begin()
res = conn.execute(insert(t_table).values(id=None,pv=6))
Hello!
I am stuck when trying to delete an object, on which there are
references. I have a database-level ON DELETE CASCADE rule, but when
issuing Session.delete, it raises an IntegrityError, cause sqlalchemy
first tries to SET NULL the references on all the children. If I use
cascade='all,
sim wrote:
creation_order = Column('creation_order', PGBigInteger, Sequence
('creation_order_seq'))
this works fine for me and this is covered in test cases too.
from sqlalchemy import *
from sqlalchemy.databases.postgres import PGBigInteger
engine =
Igor Katson wrote:
Hello!
I am stuck when trying to delete an object, on which there are
references. I have a database-level ON DELETE CASCADE rule, but when
issuing Session.delete, it raises an IntegrityError, cause sqlalchemy
first tries to SET NULL the references on all the children. If
bojanb wrote:
SQLAlchemy's unit of work attempts to set it to
None during the flush.
Doesn't that imply that ondelete='RESTRICT' is not honored by UoW?
how would the UOW honor RESTRICT ? if you tell it to delete a parent,
and you didn't tell it to delete a child, and you have a
Hi,
I'm running into an issue in 0.5.2 and 0.6.1beta where it appears that
group_concat and .op are producing incorrect SQL.
q = session.query(func.group_concat(unionq.c.status.op('order
by')(q.c.stop))
where unionq is essentially a union_all().subquery() of several
queries.
Wow, my above example sucked. Here's something close to what I'm
actually using:
qs = ...
qunion = qs[0].union_all(*qs[1:]).subquery()
joined = session.query( KnownComponents.name,
qunion,
func.group_concat(qunion.c.status.op('order
Thomas Drake wrote:
Wow, my above example sucked. Here's something close to what I'm
actually using:
qs = ...
qunion = qs[0].union_all(*qs[1:]).subquery()
joined = session.query( KnownComponents.name,
qunion,
On Oct 29, 5:32 pm, Michael Bayer mike...@zzzcomputing.com wrote:
how would the UOW honor RESTRICT ? if you tell it to delete a parent,
and you didn't tell it to delete a child, and you have a non-nullable FK
or RESTRICT, you'd expect it tothrow an error, right ? isn't that
what
bojanb wrote:
On Oct 29, 5:32 pm, Michael Bayer mike...@zzzcomputing.com wrote:
how would the UOW honor RESTRICT ? if you tell it to delete a parent,
and you didn't tell it to delete a child, and you have a non-nullable FK
or RESTRICT, you'd expect it tothrow an error, right ? isn't
Hi,
is it possible to merge an object back to session, but without merging
the entire tree of related objects. Just this one root object.
I'm trying to implement caching for my user identity framework and I
don't want to merge back the entire tree of objects reachable from the
user entity.
I
Tvrtko wrote:
Hi,
is it possible to merge an object back to session, but without merging
the entire tree of related objects. Just this one root object.
the general way is to disable merge cascade on the relation(), using
cascade='save-update' or cascade=None
I created a new user instance
Yes, the passive_deletes='all' solves this, the trick is to put it in
the backref (I was putting it in the forward relation).
On Oct 29, 8:29 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Michael Bayer wrote:
bojanbwrote:
On Oct 29, 5:32 pm, Michael Bayer mike...@zzzcomputing.com
On Oct 29, 8:44 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Tvrtko wrote:
Hi,
is it possible to merge an object back to session, but without merging
the entire tree of related objects. Just this one root object.
the general way is to disable merge cascade on the relation(), using
Tvrtko wrote:
transient objects can be merged. They get added to the session and
enter
the pending state.
I get:
InvalidRequestError: merge() with dont_load=True option does not
support objects transient (i.e. unpersisted) objects. flush() all
changes on mapped instances before
On Oct 29, 9:33 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Tvrtko wrote:
transient objects can be merged. They get added to the session and
enter
the pending state.
I get:
InvalidRequestError: merge() with dont_load=True option does not
support objects transient (i.e.
Kickass! This is fantastic. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to
Heyo,
Is there any way to specify a particular ordering on a column with the
order by clause (or otherwise)? Something like:
session.query(People).order_by(People.name, ['rick', 'james', 'bob',
'mike'])
Thanks,
-thomas
--~--~-~--~~~---~--~~
You received this
Hi all,
I must be missing something obvious here...
Let's suppose I have the following class:
class User(Base):
#
addresses = relation(Address, backref=user)
and I have a number which may be an ID of an Address object. How do I
check if the number is an ID of one of Addresses of
Sergey V. wrote:
Hi all,
I must be missing something obvious here...
Let's suppose I have the following class:
class User(Base):
#
addresses = relation(Address, backref=user)
and I have a number which may be an ID of an Address object. How do I
check if the number is an
Now on 0.4.8.
And it is just not working.
My copy method is flawed. Don't use it. The innards of sqlalchemy
are just too complicated to mess around with.
As for the cascade option. It also doesn't work. I have the following:
mapper(History, history_table, properties = dict(
user =
On Oct 29, 2009, at 7:22 PM, Tvrtko wrote:
Now on 0.4.8.
And it is just not working.
My copy method is flawed. Don't use it. The innards of sqlalchemy
are just too complicated to mess around with.
As for the cascade option. It also doesn't work. I have the following:
mapper(History,
Some assumptions:
1. SA-mapped object means the user object in the example
2. property name means addresses in the example
3. The function shouldn't assume that you want an Address object
4. The ID attribute is known ahead of time (e.g. its always id). If
not, your function will need
Ahh... I missed the relation.any() part of your example - with it the
code should behave exactly as I need. I think. I need to give it a
try.
Thanks!
On Oct 30, 9:53 am, Sergey V. sergey.volob...@gmail.com wrote:
Some assumptions:
1. SA-mapped object means the user object in the example
Sergey V. wrote:
Some assumptions:
1. SA-mapped object means the user object in the example
2. property name means addresses in the example
3. The function shouldn't assume that you want an Address object
4. The ID attribute is known ahead of time (e.g. its always id). If
not, your function
27 matches
Mail list logo