On Fri Jan 30 2015 at 4:42:42 PM Jonathan Vanasco jonat...@findmeon.com
wrote:
This should generate your second query:
q = s.query(Foo)\
.join(
Boo,
Foo.id == Boo.id
)\
.join(
Bar,
Boo.id == Bar.id
)\
.first()
But I already have
Think about it this way:
There's two kinds of strings when you're dealing with SQL: 1) SQL
language, 2) your data input. Don't ever include (2) in (1) –– let the
API do it.
\malthe
On 4 July 2011 21:41, Krishnakant Mane krm...@gmail.com wrote:
Hello all.
I use Pylons 0.9.7 and sqlalchemy.
I
Michael Bayer wrote:
well, i can support this in 0.5 trunk. in rev 4965, If a descriptor
is present on a class, or if the name is excluded via the include/
exclude lists, the attribute will not be instrumented via the
inherited mapper or via the mapped Table. So your example works with
Michael Bayer wrote:
well, i can support this in 0.5 trunk. in rev 4965, If a descriptor
is present on a class, or if the name is excluded via the include/
exclude lists, the attribute will not be instrumented via the
inherited mapper or via the mapped Table. So your example works with
Currently, classes that inherit from old-style classes are not supported
on two accounts:
1) They do not provide the __subclasses__-method
2) It's not possible to make a weak reference to them
Below is a patch that effectively ignores them:
Index: lib/sqlalchemy/util.py
Michael Bayer wrote:
well, i can support this in 0.5 trunk. in rev 4965, If a descriptor
is present on a class, or if the name is excluded via the include/
exclude lists, the attribute will not be instrumented via the
inherited mapper or via the mapped Table. So your example works with
Michael Bayer wrote:
works for me:
I tried adapting your example, which admittedly works :-), to a scenario
that better resembles mine, but now the property is overriden simply,
even when I use ``exclude_properties``.
Note that the setup is overly complex, but this should be seen in the
I have a table 'test' that defines a column 'col'. I map this table on:
class Mapper(object):
@property
def col(self):
return uSome read-only value.
passing exclude_properties=('col',).
However, when I save and commit an instance of Mapper, I get:
[snip]
UnmappedColumnError: No
Michael Bayer wrote:
oh. how are you getting it to join from soup- (album join
vinyl) ? soup has a relation to album join vinyl and you're
using query.join() ? it should be creating an aliased subquery for
the right side of the join in that case. I thought 0.4 was able to
do
When executing a query on some joined SQLA-mapper, SQLite throws the
following exception (unlike Postgres, which handles it just fine):
OperationalError: (OperationalError) no such column: album.id
Here's the query:
SELECT album.id AS album_id
FROM soup JOIN (album JOIN vinyl ON vinyl.id =
Michael Bayer wrote:
sqlite doesn't like the parenthesis. when making the joins with a
SQLA join() construct, you need to make the joins from left to right,
i.e.:
soup.join(album, ...).join(vinyl, ...)
as opposed to:
soup.join(album.join(vinyl, ...), ...)
Actually, we are sort
Michael Bayer wrote:
The most crucial, although not the issue in this specific example, is
that the relations table is used both as the secondary table in a
relation(), and is also mapped directly to the Relation class. SQLA
does not track this fact and even in a working mapping will
I can add to this that the issue occurs only on consequent appends.
Here's the excerpt that leads to the IntegrityError, demonstrating this.
collection = Collection()
session.save(collection)
session.flush()
vinyl = Vinyl()
colletion.records.append(vinyl)
Michael Bayer wrote:
you'd have to work this into a full self-contained script which I can
run locally since it seems theres some specific usage pattern creating
the issue. (i.e. its very difficult for me to piece together snippets
and guess where the issue might be occuring).
This is
Michael Bayer wrote:
A self-referential relationship, when configured as many-to-one,
requires the remote_side argument to indicate this, as described in
http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_relation_selfreferential
. Otherwise it defaults to one-to-many.
That
Michael Bayer wrote:
would need to see mappings.
First, let me mention that this issue only occurs on Postgres; I can't
replicate it on SQLite.
This is the many-to-many relation table (posted previously):
table = rdb.Table(
'relation',
metadata,
rdb.Column('id',
16 matches
Mail list logo