On Mon, Jan 26, 2009 at 7:05 PM, Michael Bayer wrote:
>
>
> On Jan 26, 2009, at 7:31 PM, Jon Nelson wrote:
>
>>
>> I assumed it was a bug due to the presence of a python-style string
>> substitution.
>>
>> ...
>>
>>> another option is
>>> sess.query(Account).filter(Account.id.in_(your subquery)).
I am working on a chemical database under Oracle 9i and SQLAlchemy
0.4.6, and I'm running into a problem.
I am creating a rather complex query in which I need the ability to
constrain that query on the basis of a query to a very specialized
view. I am doing so because chemical compounds are hash
On Jan 26, 2009, at 7:31 PM, Jon Nelson wrote:
>
> I assumed it was a bug due to the presence of a python-style string
> substitution.
>
> ...
>
>> another option is
>> sess.query(Account).filter(Account.id.in_(your subquery)).
>
> When I do it that way, I get crazy SQL and an error. Using
> Acc
I assumed it was a bug due to the presence of a python-style string
substitution.
...
> another option is
> sess.query(Account).filter(Account.id.in_(your subquery)).
When I do it that way, I get crazy SQL and an error. Using
Account.accountid to shorten the SQL:
>>> q0 =
>>> s.query(Account.
On Jan 26, 2009, at 6:21 PM, Jon Nelson wrote:
>
> If I try that, I get:
>
> sqlalchemy.exc.ProgrammingError: (ProgrammingError) aggregates not
> allowed in WHERE clause
>
> The SQL generated is:
>
> SELECT account.accountid AS account_accountid
> FROM account
> JOIN userinfo ON account.accounti
On Mon, Jan 26, 2009 at 5:21 PM, Jon Nelson wrote:
...
If I start with this subquery:
> q0 = s.query(Account.accountid,
> sa.func.count(User.userid).label('user_count'))
> .join(Account.users)
> .group_by(Account.accountid)
> .having(sa.func.count(User.userid)>1)
> .subquery
If I try that, I get:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) aggregates not
allowed in WHERE clause
The SQL generated is:
SELECT account.accountid AS account_accountid
FROM account
JOIN userinfo ON account.accountid = userinfo.accountid
WHERE count(userinfo.userid) > %(count_1)s
GR
I think you have to use group by with a count(). Something like
Account.query.join(Account.users).group_by(Account.id).filter(func.count(User.id)
> 1)
On Mon, Jan 26, 2009 at 12:59 PM, Jon Nelson wrote:
>
> Let's assume I have a 1:many relationship between Accounts and Users.
>
> What I want (f
Let's assume I have a 1:many relationship between Accounts and Users.
What I want (for example) is a list of Accounts with > 1 User.
Ideally, I'd do this:
Account.query().filter( len(Account.users) > 1 ).all()
but of course that doesn't work.
Instead of describing the myriad ways I've tried,
On Jan 26, 2009, at 1:29 PM, Toby Bradshaw wrote:
>
> Michael Bayer wrote:
>> also your example should read like this:
>>
>> a = session.query(A).all()[0]
>> print a.time_units
>> a.time_units = 1
>> print a.time_units
>> #print A.timeunits
>> #print A.time_units
>>
> Huh ? time_units is the col
Michael Bayer wrote:
> also your example should read like this:
>
> a = session.query(A).all()[0]
> print a.time_units
> a.time_units = 1
> print a.time_units
> #print A.timeunits
> #print A.time_units
>
Huh ? time_units is the column name in the database. I want to refer to
that column through t
also your example should read like this:
a = session.query(A).all()[0]
print a.time_units
a.time_units = 1
print a.time_units
#print A.timeunits
#print A.time_units
the A.time_units is the class-bound descriptor so that raises an
exception due to a missing __str__() method. this is a small bug
you're running 0.5.0rc2, an early release candidate of 0.5. There
have been five bugfix releases since then, have you tried running on
the latest release ?
On Jan 26, 2009, at 12:59 PM, Toby Bradshaw wrote:
>
> Ok.. given:
>
> CREATE TABLE example_a
> (
> id integer NOT NULL,
> time_unit
On Jan 26, 2009, at 12:50 PM, Nathan Harmston wrote:
> Hi,
>
> I am currently trying to use an SQL expression as a mapped
> attribute. I have a table called species_table and a
> species_names_tables, there is a one to many relationship between
> them on species_table.c.taxa_id and species_
Hi,
On Mon, Jan 26, 2009 at 12:54 PM, Alberto Valverde wrote:
>
> Hi,
>
> I'm proud to announce that we've just made the first public release of
> Rum and its SQLAlchemy plugin.
>
> Rum is an extensible WSGI web application to provide a RESTful interface
> for your app's model objects. You can th
Ok.. given:
CREATE TABLE example_a
(
id integer NOT NULL,
time_units integer,
CONSTRAINT example_a_pkey PRIMARY KEY (id)
)
and (based on
http://www.sqlalchemy.org/docs/05/mappers.html#using-descriptors):
from sqlalchemy import *
from sqlalchemy.orm import sessionmaker, mapper, synonym
c
Hi,
I'm proud to announce that we've just made the first public release of
Rum and its SQLAlchemy plugin.
Rum is an extensible WSGI web application to provide a RESTful interface
for your app's model objects. You can think of it as an alternative to
Django's admin for the non-django world.
I
Hi,
I am currently trying to use an SQL expression as a mapped attribute. I have
a table called species_table and a species_names_tables, there is a one to
many relationship between them on species_table.c.taxa_id and
species_names_table.c.taxa. So one species can have multiple names. I am
current
nope
On Jan 26, 2009, at 12:23 PM, Jonathon Anderson wrote:
>
> Is there a way to specify cascading at query execution time, like
>
> Session.delete(instance, cascade="all, delete-orphan")
>
> >
--~--~-~--~~~---~--~~
You received this message because you are sub
Is there a way to specify cascading at query execution time, like
Session.delete(instance, cascade="all, delete-orphan")
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, se
You might want to try select([col1, col2, col3]).select_from("scntest
AS OF SCN 123") , though that won't integrate with session.query()
unless you use from_statement().
I haven't seen that syntax before but it would otherwise have to be
added to the oracle dialect as a feature, such as sel
On Jan 25, 2009, at 8:41 PM, Brett wrote:
>
> The "Controlling Ordering" section of the docs mentions that using
> order_by on mappers is the standard way for setting a default ordering
> against a single mapped entity. This seems like a good feature. Is
> there another way? Will this be depr
g'day
i'm asking out of sheer curiosity, although it may turn more serious.
is there any known work about linking somehow SQLAlchmey and
gogole-stuff?
i looked at the google api/lang and they seem somewhat similar to
sqlalchemy's (well, like rdf-Alchemy is).
i might bite the idea of having db
23 matches
Mail list logo