-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of john smallberries
Sent: 24 August 2009 08:51
To: sqlalchemy
Subject: [sqlalchemy] negative indexes in query slices?
I just tried limiting a query to the final 10 items of a
Hi all,
I'm stucked with a problem I'm not able to solve (SA 0.5.2). I hope on
of you would be smarter than me.
Here is the problem:
import sqlalchemy as sa
__metadata__ = sa.MetaData()
OBJECTS = sa.Table('objects', __metadata__,
sa.Column('id', sa.Integer, primary_key=True),
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Laurent Rahuel
Sent: 24 August 2009 12:16
To: sqlalchemy
Subject: [sqlalchemy] ForeignKey on a ForeignKey
Hi all,
I'm stucked with a problem I'm not able to solve (SA
Hi King Simon,
Thanks for your answer but this doesn't solve my problem.
If I comment my parent_id definition in the objects_tree definition,
everything is OK with create_all() invocation.
If I change the parent_id column definition to :
sa.Column('parent_id', None, sa.ForeignKey('objects.id',
hal_robertson wrote:
AttributeError: 'Z' object has no attribute '__composite_values__'
using sqlalchemy.orm.composite to map instances of Z to composite
tables
requires that Z define __init__, __composite_values__, and ideally
__set_composite_values__, and __eq__, which are specific to how
An error would be swell. I'd already moved on to the saner solution
you mentioned, but was curous about the dont-say-limit-just-say-slice
advice I had seen, since I'd reflexively written it that way against
an ordered index query.
On Aug 24, 7:21 am, Michael Bayer mike...@zzzcomputing.com wrote:
Hmm... I must be missing something then in the mapping
This is the error I'm getting:
AttributeError: 'Z' object has no attribute '__composite_values__'
How do I do the mapping so that the Z instances map to the respective
composite tables correctly?
I assume then I do not want to use
Hi there,
I'm investigating ways to make an ORM-mapped instance read-only,
dependent the value of a particular attribute (database backed or not).
If an object has a certain state, I want to prevent normal users from
making a modification. Other objects connected to the same session
should
Hi there,
I'm looking into a reliable way to clone ORM-mapped instances, so that
the clone, with some modifications, can be re-added to the database. I
saw the following thread:
http://groups.google.com/group/sqlalchemy/browse_thread/thread/6e162f9a74697a01/6396c677b2a87797#6396c677b2a87797
hal_robertson wrote:
Hmm... I must be missing something then in the mapping
This is the error I'm getting:
AttributeError: 'Z' object has no attribute '__composite_values__'
How do I do the mapping so that the Z instances map to the respective
composite tables correctly?
I assume then
Martijn Faassen wrote:
Hi there,
I'm investigating ways to make an ORM-mapped instance read-only,
dependent the value of a particular attribute (database backed or not).
If an object has a certain state, I want to prevent normal users from
making a modification. Other objects connected to
Hey everyone,
I am running into a problem with association_proxy attributes in
SQLAlchemy 0.5 and python 2.6.
I pasted my model (a simplified version) all the way below.
My model has a Permission object, Project object and a Group object,
and it uses an AccessRule object to grant a permission to
Hi there,
I'm experimenting with a composite primary key to see whether it might
help implement a workflow system, where the primary key consists of an
identifier (code) and a workflow status.
I run into an error with the ORM (in 0.5.5 and trunk) when I modify part
of the primary key (the
Hi,
This is a table setup in declarative style:
class Category(DeclarativeBase):
__tablename__ = 'category'
category_id = Column(Integer, autoincrement=True,
primary_key=True)
name = Column(Unicode(255), unique=True, nullable=False)
children = relation('Category',
Dnia 2009-08-24, Pn o godzinie 12:35 -0700, Kees van den Broek pisze:
Hi,
This is a table setup in declarative style:
class Category(DeclarativeBase):
__tablename__ = 'category'
category_id = Column(Integer, autoincrement=True,
primary_key=True)
name = Column(Unicode(255),
you're missing a ForeignKey column back to your category_id.
Kees van den Broek wrote:
Hi,
This is a table setup in declarative style:
class Category(DeclarativeBase):
__tablename__ = 'category'
category_id = Column(Integer, autoincrement=True,
primary_key=True)
name =
the program works for me, I get:
2009-08-24 16:12:56,797 INFO sqlalchemy.engine.base.Engine.0x...1830
PRAGMA table_info(user)
2009-08-24 16:12:56,806 INFO sqlalchemy.engine.base.Engine.0x...1830 ()
2009-08-24 16:12:56,807 INFO sqlalchemy.engine.base.Engine.0x...1830
CREATE TABLE user (
Hi,
I can give all the details, but let's start with a simple question.
I have a query, and it is returning the wrong number of rows!
Not only is the number wrong compared to what I would expect, but,
more importantly, when I paste the *exact sql* (except for
substituting a param) printed on
That's it. Thanks!
Although it still took me a while to figure out how to do it. Just to
have a complete example in the mailinglist, I'll copy paste what I
have now:
class Category(DeclarativeBase):
__tablename__ = 'category'
category_id = Column(Integer, autoincrement=True,
Query(), when called with entity classes as arguments, returns only unique
entities or unique combinations thereof. to get the raw data call Query
with columns/attributes as arguments instead.
DavidG wrote:
Hi,
I can give all the details, but let's start with a simple question.
I have
I like the sneaky way. I put the basic mechanism in place but I am not
sure yet how to implement a useful and practical set of defaults (I am
referring to stuff which is totally particular to our organization and
not anything to do with SA).
very cool.
pjjH
On Aug 12, 9:30 pm, Michael Bayer
Hi Mike -
Confused. Why would it be different with the limit() or not? Without
the limit() I get *all* the Quote records (1000) which is correct. If
I have something like limit(10), I'll get *less then 10*.
Also, I didn't know about the unique entities limitation. In any
event, the Quote
I implemented a very crude flush/commit-time version of this today
that disables all modifications. Michael suggested the use of
connection_callable to provide fine-grained control of which engine to
use for modifications. I haven't gone through all the details yet but
it seems to work for my
I used a mapper extension.
On before_update, It will copy the record and add it to an array.
On after_update, It will store the new record which is an exact copy
of the old record before the update.
Please note, I implemented a base class for my storage units this is
the sqlaorm thing.
It will
DavidG wrote:
Hi Mike -
Confused. Why would it be different with the limit() or not?
well there's not enough detail to say exactly but you're applying the
limit() to a query with outer join. So if Quote number one had five
related Feedback entries, you'd get one row back for all five of
First, there is at most a single Feedback record (for a given user,
hence the subquery) per quote (and in the one case I have been banging
my head on, I am certain of this).
And this: why would I get different results from pasting the echoed
sql into the online mysql query vs from sqlalchemy
On Aug 24, 2009, at 7:44 PM, DavidG wrote:
First, there is at most a single Feedback record (for a given user,
hence the subquery) per quote (and in the one case I have been banging
my head on, I am certain of this).
And this: why would I get different results from pasting the echoed
27 matches
Mail list logo