-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Andreas Jung
Sent: 19 December 2008 06:30
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: Efficient dictificationof result sets
On 19.12.2008 2:57 Uhr, Michael Bayer
exactly, the declarative layer is syntax sugar, i.e. shorter way to
say same thing, same as elixir and dbcook - they just differ in how
many things each one automates/hides.
after that, i.e. after mappers compiled, it's all plain SA - sessions,
queries etc...
i dont know about elixir, although
Hi,
I have a similar task, so I tried to use your proposal, but it didn't
work for me:
===
from sqlalchemy import types as satypes
from sqlalchemy import schema as saschema
from sqlalchemy.engine import create_engine
from sqlalchemy.ext.declarative import declarative_base,
DeclarativeMeta
from
oops, do it like this:
class BaseType(DeclarativeMeta):
def __init__(newcls, classname, bases, dict_):
dict_['notes'] = saschema.Column(satypes.String)
DeclarativeMeta.__init__(newcls, classname, bases, dict_)
clearly we'll have to figure out a more user friendly pattern
On Friday 19 December 2008 16:58:12 Michael Bayer wrote:
oops, do it like this:
class BaseType(DeclarativeMeta):
def __init__(newcls, classname, bases, dict_):
dict_['notes'] = saschema.Column(satypes.String)
DeclarativeMeta.__init__(newcls, classname, bases, dict_)
Hi. Well, I want to output the HTML code from database. And the HTML
code should be order by 'cost' and group_by 'category'
The database table is like below.
---
ID CategoryNameCost
0 foodbanana $1
1
On Friday 19 December 2008 19:53:03 有末 清華 wrote:
Hi. Well, I want to output the HTML code from database. And the
HTML code should be order by 'cost' and group_by 'category'
The database table is like below.
---
ID CategoryName
Hi,
I am wondering if there is a way to completely decouple the
association proxy declaration from my Python classes, and contain this
to a database class? My goal is not to 'burden' developers looking at
the main part of my code with SQLAlchemy when there is no need to
directly interact with
class MyObject(object):
myObjects = association_proxy('myPropertyProxy', 'myProperty',
creator=createAssociationObject)
u mean, this one line there is 'burden' ? put all that in separate
function in another file, and just import and call it...
how about all the other table, mapper, etc
Hi,
I'm writing code (see below) to drop and add back foreign key constraints
to a db table. Incidentally, this code is not working (the function just
hangs) so I may have made some kind of syntax error. Anyway, I was
wondering if there was some way to accomplish this in a more high-level
On Dec 19, 2008, at 2:11 PM, Arn Vollebregt wrote:
Hi,
I am wondering if there is a way to completely decouple the
association proxy declaration from my Python classes, and contain this
to a database class? My goal is not to 'burden' developers looking at
the main part of my code with
From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com]
On Behalf Of Michael Bayer
On Dec 19, 2008, at 2:11 PM, Arn Vollebregt wrote:
I am wondering if there is a way to completely decouple the
association proxy declaration from my Python classes, and contain
this to a
I've created a full test case that should reproduce the error for you.
You'll need to create a database called 'test' on your local machine.
I think I've isolated the problem to the use of the creator keyword
argument, which I use in my application for various reasons.
def setup(**kwargs):
connection = MySQLdb.connections.Connection(**kwargs)
engine = create_engine('mysql://', creator=lambda: connection,
pool_recycle=2)
the creator argument is a callable that returns a new connection
when the pool needs one. Above, you are pre-connecting a
Oh, I see. I was unaware that lambda evaluated the result only once,
not each use. Thanks so much for your help.
On Dec 19, 4:36 pm, Michael Bayer mike...@zzzcomputing.com wrote:
def setup(**kwargs):
connection = MySQLdb.connections.Connection(**kwargs)
engine =
oh, whoops, shouldnt be a lambda there:
def setup(**kwargs):
def connect():
return MySQLdb.connections.Connection(**kwargs)
engine = create_engine('mysql://', creator=connect,
pool_recycle=2)
On Dec 19, 2008, at 6:56 PM, Ken wrote:
Oh, I see. I was unaware that
On Fri, 19 Dec 2008 15:10:07 -0500, Michael Bayer
mike...@zzzcomputing.com wrote:
On Dec 19, 2008, at 2:43 PM, Faheem Mitha wrote:
I'm writing code (see below) to drop and add back foreign key
constraints to a db table. Incidentally, this code is not working
(the function just hangs) so I
Hi,
just for anyone arriving here to save some time: I tried this with
0.5rc4 and the following piece of code
===
from sqlalchemy import types as satypes
from sqlalchemy import schema as saschema
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class
18 matches
Mail list logo