You could try changing your _limit tuple to a property on the class
that returns the tuple you want.
For example:
class Result(object):
def get_limit(self):
return (self.upper, self.lower, self.nominal)
_limit = property(get_limit)
Is this what you were looking for?
Stephen Emslie
hi. this question should be easy. i've searched around though and
haven't found the answer. all i want to do is know the number of
records in a result set i get using an execute statement with a simple
select. so if i do:
s=select([raw_table],and_(raw_table.c.name==m
Hi there,
I know there's a previous thread, but that's a bit old, so I thought
I'd make a new one. The UniqueConstraint for the declarative style
doesn't seem to be working for me. Using code from the last thread, I
have this:
=
class Group(Base):
__tablename__ = groups
Well, I would have expected ResultProxy.rowcount to do just that
(return the number of rows in the last executed statement) but I just
get 0 from it. Perhaps someone could explain how to use it correctly.
Stephen Emslie
On Thu, Mar 12, 2009 at 5:20 PM, jeff jeffre...@gmail.com wrote:
hi.
database cursors are essentially iterators so a total rowcount, without
fetching all the rows, is not available in a platform-agnostic way.
the usual strategy to find out how many rows of something exist in the DB
is to do SELECT COUNT(*).
Stephen Emslie wrote:
Well, I would have expected
UniqueConstraint only represents a constraint being generated along with
CREATE TABLE statements, it doesn't affect any in-python behavior. So
unless you've created your database using your declarative classes,
UniqueConstraint will have no effect.
Chris Lewis wrote:
Hi there,
I know
Hi all,
I am trying to use the postgres_returning feature with the latest svn
checkout of SqlAlchemy, Python 2.5.2, and Postgresql 8.3.
I have a declarative_base, which works in the declarative base
context. I get it's table reference this way:
al_table =
you need to execute() your insert statement. the return value of that is
where you can fetchall().
Gloria W wrote:
Hi all,
I am trying to use the postgres_returning feature with the latest svn
checkout of SqlAlchemy, Python 2.5.2, and Postgresql 8.3.
I have a declarative_base, which
Argh! I knew it had to be something simple. 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,
Hi Stephen,
Not exactly what I'm looking for (unless I misunderstand you) as I'd
like to not have the individual attributes (lower, nominal, upper) in
the class directly and carry just the _limits variable.
I have a class Result as follows:
class Result:
def __init__(self):
opened ticket 1341 for this.
http://www.sqlalchemy.org/trac/ticket/1341
--~--~-~--~~~---~--~~
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
I am encountering a problem with getting the unit tests to run on
Sybase because of cascades of errors originating from failure to drop
a table that is referenced by a FK constraint in another table. When
attempting to drop the people table, I need the SybaseSQLSchemaDropper
to emit SQL like
SQLAlchemy normally drops tables in order of foreign key dependency so
that there's no need for ALTER. in the case that two tables have a mutual
foreign key dependency, one of the ForeignKey objects has the
use_alter=True flag set so that just the one FK gets dropped first via
ALTER.
Hi Mike,
the situation I am encountering is when the other table is not part of
the metadata collection i.e. SQLAlchemy doesn't know anything about
it. It looks like the unit-tests enumerate the tables by calling
table_names() which causes has_table() and reflecttable() to be called
in turn.
phrrn...@googlemail.com wrote:
Hi Mike,
the situation I am encountering is when the other table is not part of
the metadata collection i.e. SQLAlchemy doesn't know anything about
it. It looks like the unit-tests enumerate the tables by calling
table_names() which causes has_table() and
Then I must have a bug in the FK introspection. Which unit tests would
you suggest getting running first? Is there one that specifically
tests foreign key stuff?
pjjH
On Mar 13, 3:41 pm, Michael Bayer mike...@zzzcomputing.com wrote:
phrrn...@googlemail.com wrote:
Hi Mike,
the situation I
Hi again,
I have this table, which has a composite primary key, and no sequence:
# \d log_members
Table public.log_members
Column | Type | Modifiers
+-+---
memberID | integer | not null
logentryID | integer | not null
Indexes:
log_members_pkey
phrrn...@googlemail.com wrote:
Then I must have a bug in the FK introspection. Which unit tests would
you suggest getting running first? Is there one that specifically
tests foreign key stuff?
the tests in engine/reflection.py should do a basic workup of that feature.
pjjH
On Mar 13,
ignore my previous response to this. The value for your composite primary
key columns would originate from the values present in the corresponding
row in the activity_log and members tables. If you'd like SQLa to handle
that automatically, you'd have to make usage of the relation() function to
hi. this question should be easy. i've searched around though and
haven't found the answer. all i want to do is know the number of
records in a result set i get using an execute statement with a simple
select. so if i do:
s=select([raw_table],and_(raw_table.c.name==m
thanks i will use select count (*)
i was making a leap that there would be something in pgdb which allows
a function like:
sql_txt = select * from addresses
cursor.execute(sql_txt)
rows=cursor.fetchall()
rows_returned = cursor_result.rowcount
where the rowcount property contains the number of
put autoincrement=False on those columns.
Gloria W wrote:
Hi again,
I have this table, which has a composite primary key, and no sequence:
# \d log_members
Table public.log_members
Column | Type | Modifiers
+-+---
memberID | integer | not null
If you use
rows = cursor.fetchall()
you have already executed the query and the result is a list of RowProxy's
returned by the query. Count then is simply
count = len(rows)
Otherwise, the count(*) approach is correct.
--
Mike Conley
On Fri, Mar 13, 2009 at 4:42 PM, jeff
thank you that got me where i was trying to get.
originally in the first example i was not adding the fetchall(). len()
and rowcount were not yielding anything in that case. then once
fetchall() was added i used len() as suggested and it worked.
thanks.
On Mar 13, 9:30 pm, Mike Conley
Hello,
Will anyone recommend me a nice tool to view/analyze my databases? I
normally use the shell and SA but I'm starting a project with an
existing db (and heavy on db procedures and trigger) so I'll like to
have some sort of GUI to simplify my learning curve.
After some searching I found
Excellent, thank you. I won't get to try this until Monday.
Gloria
--~--~-~--~~~---~--~~
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
26 matches
Mail list logo