Hi, all
the followings are the code snippet
from sqlalchemy import *
meta = MetaData('sqlite://')
parent = Table('parent', meta,
Column('id', Integer, primary_key=True),
Column('name', Integer)
)
child = Table('child', meta,
Column('id', Integer, primary_key=True),
Just wondering if this is a bug in _determine_fks
i.e. 'child.id' probably should not be part of the foreign key
pointing to parent
On Nov 6, 7:42 pm, Esceo [EMAIL PROTECTED] wrote:
Hi, all
the followings are the code snippet
from sqlalchemy import *
meta = MetaData('sqlite://')
Hi everyone!
I'm new in SQLAlchemy and this is my code:
mappers['indicatorgroups'] = mapper(IndicatorGroups, tables['indicatorgroups'])
mappers['groupgroups'] = mapper(GroupGroups, tables['groupgroups'],
properties = {
'idindicatorgroupcontainer' :
lur ibargutxi wrote:
'idindicatorgroupcontainer' : relation(IndicatorGroups,
primaryjoin=sql.and_(IndicatorGroups.idindicatorgroup==GroupGroups.idindicatorgroupcontainer)),'idindicatorgroupcontained'
: relation(IndicatorGroups,
lur ibargutxi wrote:
I forgot. Try using tables instead of classes that are not mapped yet..
mappers['groupgroups'] = mapper(GroupGroups, tables['groupgroups'],
properties = {
'idindicatorgroupcontainer' : relation(IndicatorGroups,
the fix? was to add a check for self referential foreign keys in non-
self-referential relations, and do not add those as part of the
relation's foreign key collection,
is this anywhere near the correct thing to do?
# ignore self referential keys
if not
thanks a lot. That's the solution.
2007/11/6, Marco Mariani [EMAIL PROTECTED]:
lur ibargutxi wrote:
I forgot. Try using tables instead of classes that are not mapped yet..
mappers['groupgroups'] = mapper(GroupGroups, tables['groupgroups'],
If I define a table like that:
Table('t', metadata, Column('c', Integer, primary_key=True))
then SQLAlchemy creates the column c as a SERIAL on PostgreSQL.
Is there a way to tell SQLAlchemy to create an ordinary integer primary
key, without any associated sequence?
-- Chris
Hi,
Is there a way to tell SQLAlchemy to create an ordinary integer primary
key, without any associated sequence?
Sure... autoincrement=False
Paul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy
Paul Johnston wrote:
Is there a way to tell SQLAlchemy to create an ordinary integer primary
key, without any associated sequence?
Sure... autoincrement=False
Thanks a lot. Found it now in the API docs.
I propose that this (and the fact that it is True by default) be also
Hi all,
when I try to build up a complicated query like this:
query = session.query(Class)
query = query.filter_by(...).add_entity(...).join(...)
count = query.count()
query = query.add_entity(...).join(...).order_by(...)
print query.all()
the last statement fails due to a broken SELECT. The
Slicing of Query instances can return inconsistent types if negative
stop/start values are used.
The below patch to tes/orm/query.py demonstrates the issue. When
slices with negative stop/start values are used, a list type is
returned. When positive values are used, a Query instance is returned.
Sorry, I was not finished yet.
The outline is a follows: I want to join three relations unary o
nullary o squared, where squared = binary^2, and find out which
elements n are in relation n (unary o nullary o squared) fixed to some
nullary element fixed.
Here are the details:
from sqlalchemy
On Nov 6, 2007, at 7:03 AM, Esceo wrote:
the fix? was to add a check for self referential foreign keys in non-
self-referential relations, and do not add those as part of the
relation's foreign key collection,
is this anywhere near the correct thing to do?
possibly. but id prefer not to
the (child.c.current_id ==child.c.id) part of the parent relation is
the culprit here, and also its nonsensical. the relation between
parent and child is strictly based on the FK between those two
tables. additionally its by definition a many-to-one relation; there
is only one possible
Hi all,
the following mapped select results in the wrong query. The problem
seems to be related to the number of values in a list passed to in_
and maybe to holes in the list of chosen values.
from sqlalchemy import *
from sqlalchemy.orm import *
metadata = MetaData(...)
Hi,
I am also interested in retrieving all the attributes resulting from the
ORM.
The loop on '.c' will list only the database columns. Is there a way to
list the object attributes?
Thanks a lot for your help,
Chris
-Original Message-
From: sqlalchemy@googlegroups.com [mailto:[EMAIL
all of them? same as any Python object:
obj_attributes = [k for k in obj.__dict__]
On 11/6/07, Christophe Alexandre [EMAIL PROTECTED] wrote:
Hi,
I am also interested in retrieving all the attributes resulting from the
ORM.
The loop on '.c' will list only the database columns. Is there
You may be interested in an older thread, 'How to get list of
relations':
http://groups.google.com/group/sqlalchemy/browse_thread/thread/ff03af921
eb12acb/861597e8a72f5e6f
Simon
-Original Message-
From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Christophe
Once i did what you said, I'm trying to insert values to the db:
indg=IndicatorGroups(idindicatorgroup=None, name=group)
session.save(indg)
session.flush()
indsg=IndicatorGroups(idindicatorgroup=None, name=subgroup)
session.save(indsg)
session.flush()
I create two IndicatorGroups but when I
I insert a raw into a table and then retrieve again but columns which
are filled by a db trigger don't return the updated values.
The following is a code snippet and I wonder what I am missing.
engine = sa.create_engine(url, encoding='utf8', echo=False)
Session =
On Nov 6, 2007, at 12:20 PM, Werner F. Bruhin wrote:
I insert a raw into a table and then retrieve again but columns which
are filled by a db trigger don't return the updated values.
The following is a code snippet and I wonder what I am missing.
engine = sa.create_engine(url,
hi.
i have somewhat messy setup (~test case), about association with
intermediate table/class, double pointing to one side and single
pointing to another. i do set up both A-links in one item; and set up
only first in another item, the other link (a2_link) is pre-set to None.
And, i have the
[EMAIL PROTECTED] wrote:
sorry, here the files
and the line 83 ( marked XXX ) there must be =None to get the error.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send
I cant reproduce this one. I see you have named bind params so I
tried with postgres. it also works with sqlite. works with release
0.4.0 as well as the trunk.output is (with echoing):
SELECT testView.id AS testView_id, testView.data AS
testView_data
FROM (SELECT test.id AS id,
this is how its designed to work at the moment. if the slices are
negative, it evaulates the query fully and returns the slice against
the actual list. complicating matters more, we just had a feature
request today to wrap the query in a subquery if additional criterion,
such as order
ugh can you attach a zipfile please, they came out inline
On Nov 6, 2007, at 5:46 PM, [EMAIL PROTECTED] wrote:
sorry, here the files
hi.
i have somewhat messy setup (~test case), about association with
intermediate table/class, double pointing to one side and single
pointing to another.
I also forgot to mention, the usual workaround here is just to specify
foreign_keys on the relation() manually. so this works:
pj = (child.c.parent_id == parent.c.id) (child.c.current_id
==child.c.id)
mapper(Child, child,
properties = { 'parent' : relation(Parent,
Thanks Micahel,
What I intend to model is slightly out of convention here,
The child model has a reference back to the parent, and at the same
time a reference back to the current copy of itself.
On the parent's end, it's only supposed to pick up the current copy,
therefore the additional
indeed its extremely difficult to reproduce this one, and while it was
pretty clear what caused it i found it impossible to work up a simpler
set of tables that could create all the conditions necessary to
produce an invalid query...in any case the offending code was some
stuff that wasnt
nevermind, this one was pretty straightforward and r3695 didnt
actually break things, it just revealed the lack of checking for
things elsewhere, so works in r3747.
On Nov 6, 2007, at 5:50 PM, [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
sorry, here the files
and the line 83 (
On Nov 6, 2007, at 8:24 PM, Esceo wrote:
Thanks Micahel,
What I intend to model is slightly out of convention here,
The child model has a reference back to the parent, and at the same
time a reference back to the current copy of itself.
On the parent's end, it's only supposed to pick
What I am slightly unsure about is how the viewonly flag affect the
unit of work process.
If i have acquired most_recent_child through parent, and made change
to it, will they be saved as part of uow process? (guess I should just
do a test)
Lei
On Nov 7, 12:43 pm, Michael Bayer [EMAIL
Hi,
In the release note of 0.3.7, the following is mentioned:
- much improved auto-reconnect support
But how can one configure this? I am using 0.3.10 with Postgresql.
Very often, after some period of inactivity, the connection is closed
and the whole application has to be closed and restarted
I am looking to filter specific columns in a table, but I cannot find
how to do this. I can filter by setting these columns to a value, but
not just grabbing the entire column. In SQL, I want to do this:
SELECT artist FROM artist_table, where the only column kept is
artist. The reason I want to
Michael Bayer wrote:
nevermind, this one was pretty straightforward and r3695 didnt
actually break things, it just revealed the lack of checking for
things elsewhere, so works in r3747.
yes, that works.
but now multiple other things broke. pf
- the mapper.properties in its new
2007/11/6, lur ibargutxi [EMAIL PROTECTED]:
Once i did what you said, I'm trying to insert values to the db:
indg=IndicatorGroups(idindicatorgroup=None, name=group)
session.save(indg)
session.flush()
indsg=IndicatorGroups(idindicatorgroup=None, name=subgroup)
session.save(indsg)
37 matches
Mail list logo