Use rowcount property of the ResultProxy returned from delete/update
result = conn.execute(tbl.delete())
count = result.rowcount
Note that the quality of the number will depend on the underlying database
and Python dbapi.
--~--~-~--~~~---~--~~
You received this
Hi there,
The relation() logic lets you write an additional filter into a relation
if you provide your own primaryjoin.
The case I'm dealing with is a case where I want to take over the
primaryjoin that is autogenerated by the RelationProperty object, but
amend it with an extra filter.
This
Wyatt Lee Baldwin wrote:
I have a relation defined like this in a declarative-style class:
route = relation(
RouteDef,
primaryjoin=(
(route_number == RouteDef.route_number)
(route_begin_date = RouteDef.route_begin_date)
),
)
Martijn Faassen wrote:
Hi there,
The relation() logic lets you write an additional filter into a relation
if you provide your own primaryjoin.
The case I'm dealing with is a case where I want to take over the
primaryjoin that is autogenerated by the RelationProperty object, but
amend it
Michael Bayer wrote:
[snip]
Whats missing here is the context.
I want to define ORM relations in the mapper that I can access without
having to do a manual join.
Normally you'd do this:
mapper(A, a_table,
properties={
'bs': relation(B , backref='a',
i made a test
i did that without sql alchemy orm:
import MySQLdb
import time
# Establich a connection
db = MySQLdb.connection(host=192.168.45.28,
user=apm,
passwd=apm,
db=test_christian)
# Run a MySQL query from Python and get the result set
xref
Christian Démolis wrote:
i made a test
i did that without sql alchemy orm:
import MySQLdb
import time
# Establich a connection
db = MySQLdb.connection(host=192.168.45.28,
user=apm,
passwd=apm,
db=test_christian)
# Run a MySQL query from
Martijn Faassen wrote:
But I'd like to automate this:
mapper(A, a_table,
properties={
'bs': my_own_relation(B , backref='a'),
})
my_own_relation behaves like relation, except it adds an extra clause
restricting the query, say, b_table.c.status == 'FOO'. It
On Sep 29, 7:55 am, Michael Bayer mike...@zzzcomputing.com wrote:
Wyatt Lee Baldwin wrote:
I have a relation defined like this in a declarative-style class:
route = relation(
RouteDef,
primaryjoin=(
(route_number == RouteDef.route_number)
Wyatt Lee Baldwin wrote:
In my view (which may be warped), a Trip has one Route (and many
Trips follow the same Route). Here's more context:
class Trip(Base):
__tablename__ = 'trip'
__table_args__ = dict(schema='trans')
__mapper_args__ = dict(
Hi
Here's my case: I have
- my own TypeEngine class, MyTypeEngine
- a Table with a Column using MyTypeEngine:
table = Table(tablename, metadata,
Column(columname, MyTypeEngine()),
autoload=True, autoload_with=engine
)
- a class:
class MyClass(object):
pass
- and a
Eric Lemoine wrote:
Hi
Here's my case: I have
- my own TypeEngine class, MyTypeEngine
- a Table with a Column using MyTypeEngine:
table = Table(tablename, metadata,
Column(columname, MyTypeEngine()),
autoload=True, autoload_with=engine
)
- a class:
class
On Tue, Sep 29, 2009 at 9:04 PM, Michael Bayer mike...@zzzcomputing.com wrote:
Eric Lemoine wrote:
Hi
Here's my case: I have
- my own TypeEngine class, MyTypeEngine
- a Table with a Column using MyTypeEngine:
table = Table(tablename, metadata,
Column(columname, MyTypeEngine()),
Hey,
Michael Bayer wrote:
OK well I'm sure you noticed that RelationProperty was not designed to be
subclassed.
Yeah, my subclass isn't pretty. :)
I would advise that your my_own_relation() function generate
its own primaryjoin and secondaryjoin conditions which it passes as
arguments to
On Sep 29, 11:53 am, Michael Bayer mike...@zzzcomputing.com wrote:
Wyatt Lee Baldwin wrote:
In my view (which may be warped), a Trip has one Route (and many
Trips follow the same Route). Here's more context:
class Trip(Base):
__tablename__ = 'trip'
__table_args__ =
Wyatt Lee Baldwin wrote:
Anyway the primaryjoin here looks fine and does
represent the same thing you're getting in your route() @property.
It's
a simple many-to-one with an additional criterion. Nothing needs to be
configured in the database as far as foreign keys, configuring it as
On Sep 29, 2:00 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Wyatt Lee Baldwin wrote:
Anyway the primaryjoin here looks fine and does
represent the same thing you're getting in your route() @property.
It's
a simple many-to-one with an additional criterion. Nothing needs to be
This is very confusing; I have an ORM generated SQL statement that is
joining on a specific id. However, when I run it, for some reason,
the specific id (that was joined on) is occasionally None! However,
when I run the generated SQL copied from the server's debug log in
SQLDeveloper, I get all
Wyatt Lee Baldwin wrote:
On Sep 29, 2:00 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Wyatt Lee Baldwin wrote:
Anyway the primaryjoin here looks fine and does
represent the same thing you're getting in your route() @property.
It's
a simple many-to-one with an additional
Andrew wrote:
This is very confusing; I have an ORM generated SQL statement that is
joining on a specific id. However, when I run it, for some reason,
the specific id (that was joined on) is occasionally None! However,
when I run the generated SQL copied from the server's debug log in
On Sep 29, 3:12 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Wyatt Lee Baldwin wrote:
On Sep 29, 2:00 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Wyatt Lee Baldwin wrote:
Anyway the primaryjoin here looks fine and does
represent the same thing you're getting in your
21 matches
Mail list logo