On Sep 15, 2010, at 12:10 PM, Chris Withers wrote:
On 15/09/2010 15:04, Nikolaj wrote:
Base = declarative_base()
class Person(Base):
__tablename__ = 'people'
name = Column(String, primary_key=True)
@classproperty
def bar(cls):
return cls.foo
Can you
On Aug 21, 2010, at 1:38 PM, Michael Bayer wrote:
On Aug 19, 2010, at 6:38 AM, Yap Sok Ann wrote:
With declarative base, is it possible to use a relationship within a
column_property?
you mean, as I am seeing below, to use the any() operator produced by a
relationship...
Here's
With declarative base, is it possible to use a relationship within a
column_property? Here's some sample code to illustrate what I want to
achieve:
from sqlalchemy.engine import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import column_property,
Hi Michael,
I'm guilty of two over-simplifications in the code used in my example...
Firstly, the substring property/column (with which I had a problem) applies
to a subclass (using joined table inheritance) and the variable to which
it applies is specified in its parent class. Hence, I started
On Aug 3, 2010, at 7:47 AM, Robert Sudwarts wrote:
Hi Michael,
I'm guilty of two over-simplifications in the code used in my example...
Firstly, the substring property/column (with which I had a problem) applies
to a subclass (using joined table inheritance) and the variable to which it
Please see my comments below.
Regards,
Rob
On 3 August 2010 14:05, Michael Bayer mike...@zzzcomputing.com wrote:
On Aug 3, 2010, at 7:47 AM, Robert Sudwarts wrote:
Hi Michael,
I'm guilty of two over-simplifications in the code used in my example...
Firstly, the substring
Hi
I'm relatively new to SQLAlchemy, so thanks in advance for any help
with this issue.
I'm trying to construct a class to model a legacy table which has a
composite primary key which is also
a composite foreign key referencing the composite primary key of a
second table. I'm trying to define
On Aug 3, 2010, at 10:24 PM, jgs9000 wrote:
Hi
I'm relatively new to SQLAlchemy, so thanks in advance for any help
with this issue.
I'm trying to construct a class to model a legacy table which has a
composite primary key which is also
a composite foreign key referencing the composite
Hi,
I'm having trouble understanding the correct syntax to be used with
Declarative and a column property.
The select statement I'm using is:
select([func.substr(my_table.c.my_string, 2, 3)]).label(my_substr'),
deferred=True
And (as per the docs using the expanded syntax, this works as expected.
On Aug 2, 2010, at 12:19 PM, Robert Sudwarts wrote:
Hi,
I'm having trouble understanding the correct syntax to be used with
Declarative and a column property.
The select statement I'm using is: select([func.substr(my_table.c.my_string,
2, 3)]).label(my_substr'), deferred=True
And (as
On Aug 2, 2010, at 1:40 PM, Michael Bayer wrote:
On Aug 2, 2010, at 12:19 PM, Robert Sudwarts wrote:
Hi,
I'm having trouble understanding the correct syntax to be used with
Declarative and a column property.
The select statement I'm using is:
Hi,
if I declaratively map a class with a mix-in and with a __table__
definition that contains the columns in the mix-in, like so:
class MyMixin(object):
id = Column(Integer, primary_key=True)
def foo(self):
return 'bar'+str(self.id)
class MyModel(Base,MyMixin):
__table__ =
On Jun 4, 2010, at 3:21 PM, Gunnlaugur Briem wrote:
Hi,
if I declaratively map a class with a mix-in and with a __table__
definition that contains the columns in the mix-in, like so:
class MyMixin(object):
id = Column(Integer, primary_key=True)
def foo(self):
return
Hi,
i have a working declarative configuration that has a relation as
this::
client = relation(Cliente, backref='jobs' , lazy=False,
order_by=status.desc)
now I'd like to add a second column in the order_by field but adding a
list doesn't seem to work. I tried:
client = relation(Cliente,
Hi All,
Let's say that when a database record is added or updated, I need to
perform some arbitrary action (in my case, ensuring that data in other
tables is consistent with what is being committed.)
What mechanisms are suggested for this? I could add a save() method to
my declarative class that
Daniel Robbins wrote:
Let's say that when a database record is added or updated, I need to
perform some arbitrary action (in my case, ensuring that data in other
tables is consistent with what is being committed.)
What mechanisms are suggested for this?
Mapper extesions:
On Wed, Apr 28, 2010 at 10:04 AM, Chris Withers ch...@simplistix.co.uk wrote:
Daniel Robbins wrote:
Let's say that when a database record is added or updated, I need to
perform some arbitrary action (in my case, ensuring that data in other
tables is consistent with what is being committed.)
Daniel Robbins wrote:
On Wed, Apr 28, 2010 at 10:04 AM, Chris Withers
ch...@simplistix.co.uk wrote:
Daniel Robbins wrote:
Let's say that when a database record is added or updated,
I need to
perform some arbitrary action (in my case, ensuring that
data in other
tables is
On Wed, Apr 28, 2010 at 10:25 AM, King Simon-NFHD78
simon.k...@motorola.com wrote:
The declarative docs include an example of using a MapperExtension:
http://www.sqlalchemy.org/docs/reference/ext/declarative.html#mapper-con
figuration
Great, thanks for everyone's help. This is exactly the
Hi all,
I'm playing around with sqlalchemy for a new project and it's really
great :) ... up to now.
I'm in front of a problem:
let's say I have several classes:
class ParameterDefinition(Base):
__tablename__ = ParameterDefinitions
__table_args__ = {'mysql_engine':'InnoDB'}
Type =
Eagleamon wrote:
Hi all,
I'm playing around with sqlalchemy for a new project and it's really
great :) ... up to now.
I'm in front of a problem:
let's say I have several classes:
class ParameterDefinition(Base):
__tablename__ = ParameterDefinitions
__table_args__ =
You can always do self.session.add(self) in save() without checks. If
your model was already associated with the session before, it won't add
it again.
Here's sample code I use:
def save(self, flush=False):
self.session.add(self)
if flush:
self.session.flush()
def
I am using declarative style models and very much happy about it.
I see __table__ contains the classic sa.Table reference for advanced
queries. Like that do we have session is attached to the model class
derived from declarative_base?
I am very much curious to make django/rail style save,
Hello,
I'm trying to override column type in a single-table inheritance, using
declarative syntax and a bit stuck. Is it possible at all?
Sample code:
class Person(DeclarativeBase):
id = Column(Integer, primary_key=True)
test = Column(Integer, unique=True)
class Engineer(Person):
What I think I'm seeing is that an object can be created even without it's
ForeignKeyConstraint being filled.
To run the test code below:
$ dropdb test18; createdb test18; python testcode.py
This builds on
http://groups.google.com/group/sqlalchemy/browse_thread/thread/eb240f3f2555a5e7/
.
I
Hi All
I've been reading the documentation for ages and i can't figure out
why when i print the results a query from my inherited table, It just
prints them as the base type.
I was hoping someone here would be nice enough to help me solve this
problem.
I thought the last print statement would
Hi,
I need to implement the storage of the neighborood of a place. I try to
use Declarative and relation to get this done but it sounds like I
missed something important I can not understand.
Here are my models:
neighbors_table = Table('neighbors', Base.metadata,
Column('shop_id',
Is there a way to declaratively create many to many relationships
where the 'secondary' parameter for the relationship is deferred ?
I couldn't get this to work, e.g.
class User(DeclarativeBase):
id = Column(Integer, primary_key=True)
name = Column(String(20))
groups =
Hi
How do i define a delete-orphan using declarative base?
I am using sqlite and SA0.5.5
I have defined a one to one relation.
class Child(DeclarativeBase):
__tablename__='children'
id=Column(String(50),primary_key=True)
parent_id=Column(String(50),ForeignKey
Hi, Allen!
You can use something like this (yeah, I know that it isn't
declarative in any way):
class Node(Base):
__tablename__ = 'node'
id = Column(Integer, primary_key=True)
parent_id = Column(ForeignKey('node.id'))
parent = relation(Node,
On Aug 13, 2:37 pm, Anton Gritsay gene...@angri.ru wrote:
Hi, Allen!
You can use something like this (yeah, I know that it isn't
declarative in any way):
class Node(Base):
__tablename__ = 'node'
id = Column(Integer, primary_key=True)
parent_id =
On Aug 13, 2009, at 9:23 PM, allen.fowler wrote:
On Aug 13, 2:37 pm, Anton Gritsay gene...@angri.ru wrote:
Hi, Allen!
You can use something like this (yeah, I know that it isn't
declarative in any way):
class Node(Base):
__tablename__ = 'node'
id =
Werner,
On Aug 7, 12:36 pm, werner wbru...@free.fr wrote:
Allen,
allen.fowler wrote:
On Aug 6, 6:54 pm, AF allen.fow...@yahoo.com wrote:
Hello all,
Has anyone here used the sqlamp: Materialized Path for SQLAlchemy
library?
I am wondering:
1) Does it seem to work well?
2)
On Aug 6, 6:54 pm, AF allen.fow...@yahoo.com wrote:
Hello all,
Has anyone here used the sqlamp: Materialized Path for SQLAlchemy
library?
I am wondering:
1) Does it seem to work well?
2) Did you use it with Declarative Base, and if so, how did you
configure it?
Anybody?
Allen,
allen.fowler wrote:
On Aug 6, 6:54 pm, AF allen.fow...@yahoo.com wrote:
Hello all,
Has anyone here used the sqlamp: Materialized Path for SQLAlchemy
library?
I am wondering:
1) Does it seem to work well?
2) Did you use it with Declarative Base, and if so, how did you
Hello,
What is the correct way to use remote_side single_parent relation
parameters under Declarative Base?
I'm trying to create an Adjacency List Relationship as suggested in
the docs, but I am not sure how to do this with Declarative Base.
I tried:
children = relation(Node,
Hello all,
Has anyone here used the sqlamp: Materialized Path for SQLAlchemy
library?
I am wondering:
1) Does it seem to work well?
2) Did you use it with Declarative Base, and if so, how did you
configure it?
Thank you,
:)
--~--~-~--~~~---~--~~
You received
Hi,
I´ve just using sqlalchemy 0.5.1 with python 2.6 and turbogers, but I
found a little problem trying to configurate adjacency relationship
with declarative base.
My object class is something like this:
class QueryGroup(DeclarativeBase):
__tablename__ = 'queries_group'
qry_grp_id =
I have read over
http://www.sqlalchemy.org/docs/05/ormtutorial.html#using-subqueries
and http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg11439.html,
but I'm having trouble putting the pieces together.
In the demo() below, I want to find the row in the database with the
max for every
Hello, error in declarative query with defer
class ClassDefaults(dec.DeclarativeMeta):
def __init__(cls, classname, bases, dict_):
dict_['id'] = Fdb.Unicode(Adb.Length(55),
Adb.Primary_Key(True), Adb.Unique(True), Adb.Nullable(False))
dict_['status'] =
I assume I am over looking some simple thing, but I just can't seem to
find it. Thanks for the assist, I have palms open ready for face
planting.
Using a class and table with orm.mapper()
class Child(object):
pass
child_table = Table('child', meta.metadata,
Column('parent_id',
Hi,
I would like to use an association object with two tables derived from
two declarative base classes.
What would be (if one may say) the right way to access (get and set)
the additional values in the association object?
When I set the 2 entities from the base classes and associate them I
get
Hi guys and girls,
I've recently discovered the joys of using sqlalchemy and would love
to using it together with Traits. A few months back there was an
attempt to integrate sqlalchemy into traits, though it wasn't really
comprehensive in exploiting all of sqlalchemy's potential.
So I'm trying
The ID field in a declarative base is a sequence that is not controled
by the user (or is it?).
Is there a way to get it to start the counting of the ID from 0 and
not from 1?
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
Hi!
I try to clean up my code, and read in google group about possibility
create relation to self when class is not defined yet. I write
example,
but got an error (see below).
My code is:
cut
engine = create_engine('sqlite:///:memory:', echo=True)
Base =
I have a table that defines a self-referential hierarchy. My problem
is figuring out how to specify that relationship in declarative
syntax. From reading the documentation and looking at example
basic_tree.py, I think I understand it when using tables and mappers,
but can't get it right with
Does somebody know if is possible to use a declarative class
definition for the schema below
content = Table('content', meta.metadata,
Column('id', types.Integer, primary_key=True, autoincrement=True),
Column('title', types.String(80)),
Column('parent_id', types.Integer,
Hi everyone!
I'm new to SQLAlchemy and I'm using version 0.5rc1..
I need every entity class to have a few common fields, so I tried
writing an abstract base class, declarative-style, that every other
entity class would subclass. So for example:
---
from sqlalchemy.ext.declarative import
On Sep 18, 2008, at 4:08 PM, Doug Latornell wrote:
With some help from Ned Batchelder I was able to confirm that this is
a Python bug: http://bugs.python.org/issue1569356 that has been fixed
since the 2.5.2 release. Ned confirmed that the fix is included in
Python 2.6a3.
well
With some help from Ned Batchelder I was able to confirm that this is
a Python bug: http://bugs.python.org/issue1569356 that has been fixed
since the 2.5.2 release. Ned confirmed that the fix is included in
Python 2.6a3.
Doug
On Sep 16, 5:22 pm, Doug Latornell [EMAIL PROTECTED] wrote:
Thanks
Hi all,
I'm a new user (like this week) of SqlAlchemy and I'm trying to find
more information about using the Declarative system. In particular I'm
trying to build a hierarchical table with one-to-many relationships
within the table. So if anyone knows where there might be some
additional
Over on the TurboGears list a TG2 user pointed out a problem that
arises when nosetests --with-coverage is run on a project with a
sqlalchemy identity model:
http://groups.google.com/group/turbogears/t/7fd3639a5a4d4b8c
I dug into it and have reproduced the problem outside of TurboGears 2
and
Doug Latornell wrote:
Over on the TurboGears list a TG2 user pointed out a problem that
arises when nosetests --with-coverage is run on a project with a
sqlalchemy identity model:
http://groups.google.com/group/turbogears/t/7fd3639a5a4d4b8c
I dug into it and have reproduced the problem
On Sep 16, 2008, at 7:25 PM, Doug Latornell wrote:
Over on the TurboGears list a TG2 user pointed out a problem that
arises when nosetests --with-coverage is run on a project with a
sqlalchemy identity model:
http://groups.google.com/group/turbogears/t/7fd3639a5a4d4b8c
I dug into it and
Thanks for the quick replies, Jason and Michael, and for the very
succinct test case. I will try to raise this with Ned Bachelor over
at http://nedbatchelder.com/code/modules/coverage.html
Doug
On Sep 16, 4:55 pm, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 16, 2008, at 7:25 PM, Doug
What is the proposed stability of declarative functions which I guess
are pretty new. From what I've read so far I really like it and was
thinking of using it, but was just wondering what the long turn outlook
for it looked like? After doing some reading on the new release of
Elixir, Elixir
Hi,
I'm trying to follow the declarative example in the tutorial with
0.5.0b2, and it's failing to work:
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:', echo=True)
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
from
101 - 157 of 157 matches
Mail list logo