[sqlalchemy] Re: 'MapperExtension' object has no attribute 'translate_row'

2007-05-04 Thread King Simon-NFHD78
Hi, Your TaskExtension class doesn't have a translate_row method, which apparently is part of the MapperExtension interface (although it doesn't appear in the docs). From the source code (in orm/mapper.py): def translate_row(self, mapper, context, row): Perform pre-processing on the

[sqlalchemy] Re: elixir, sqlalchemy myqldb: Error connectiong to local socket

2007-05-09 Thread King Simon-NFHD78
Pirkka wrote: I started migrating from ActiveMapper to Elixir, and have been wrestling with this for hours: DBAPIError: (Connection failed) (OperationalError) (2005, Unknown MySQL server host '/Applications/MAMP/tmp/mysql/mysql.sock' (1)) Here are the command parameters that sqlalchemy

[sqlalchemy] Re: auto-load ForeignKey references?

2007-05-10 Thread King Simon-NFHD78
Max Ischenko wrote: On May 10, 4:38 pm, King Simon-NFHD78 [EMAIL PROTECTED] wrote: You're halfway there with your 'posts' relation. I think if you pass backref='author' in your relation, then WordpressPost objects will get an 'author' property which points back to the WordpressUser

[sqlalchemy] Re: how to retrieve/update data from/on multiple databases

2007-05-30 Thread King Simon-NFHD78
I think the answer to this partly depends on which parts of SA you are using, and how your databases are set up. If all the databases have different schemas, and you are using the low-level SA API (or your ORM objects are each defined against a single database), I would probably use a

[sqlalchemy] Autoloading tables on old versions of MySQL

2007-06-14 Thread King Simon-NFHD78
Hi, I just noticed that autoloading of tables on old versions of MySQL is broken (I'm using 3.23.58, but I believe the problem will occur up to 4.1.1) The problem is that reflecttable tries to use the 'character_set_results' system variable, which was only introduced in 4.1.1. The attached patch

[sqlalchemy] Re: UniqueObject recipe and turbogears

2007-06-19 Thread King Simon-NFHD78
The way to hook most parts of the ORM is by creating a MapperExtension http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_exte nding. Basically, define a subclass of MapperExtension, overriding whichever method you are interested in (possibly append_result or create_instance in

[sqlalchemy] Re: Creating where clauses programatically

2007-07-06 Thread King Simon-NFHD78
SQLAlchemy Column objects override the '==' operator (and many others as well) so that python expressions get converted to appropriate SQL expressions. It's mentioned (briefly) here: http://www.sqlalchemy.org/docs/sqlconstruction.html#sql_whereclause Hope that helps, Simon -Original

[sqlalchemy] Re: Model to Dictionary

2007-07-24 Thread King Simon-NFHD78
What do you mean by a model? If you are talking about an instance of a mapped class, you could try something like this (untested): def model_to_dict(instance): model_dict = {} for propname in instance.mapper.props: model_dict[propname] = getattr(instance, propname) return

[sqlalchemy] Re: lazy table creation

2007-07-27 Thread King Simon-NFHD78
You want something like this: user_table = Table('users', metadata, Column('userid', String(8))) user_table.create(checkfirst=True) # or # metadata.create_all(checkfirst=True) Documentation is at: http://www.sqlalchemy.org/docs/metadata.html#metadata_creating Hope that helps, Simon

[sqlalchemy] Re: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-31 Thread King Simon-NFHD78
databases/mysql.py has this snippet in create_connect_args (0.3.10): # FOUND_ROWS must be set in CLIENT_FLAGS for to enable # supports_sane_rowcount. client_flag = opts.get('client_flag', 0) if self.dbapi is not None: try: import

[sqlalchemy] Re: Hierachical data

2007-08-03 Thread King Simon-NFHD78
Hi, I think this is a pretty good match for Joined Table polymorphic inheritance, as described in the docs http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_inhe ritance_joined. Your nodes_table would correspond to the employees table, and the 'subclass' tables such as video

[sqlalchemy] Re: Outerjoin with a subset of columns

2007-08-15 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mc Sent: 15 August 2007 14:23 To: sqlalchemy Subject: [sqlalchemy] Outerjoin with a subset of columns Hi, Note the following code: oj=outerjoin(s,f)

[sqlalchemy] Re: Auto load problem with SQLAlchemy 0.3.10 and mySQL

2007-09-20 Thread King Simon-NFHD78
Noufal wrote: snip I create two tables like so run_table = sa.Table('runs',md, sa.Column('rid', sa.Integer, primary_key=True), sa.Column('cmdline', sa.String(250)), sa.Column('hostname',

[sqlalchemy] LIMIT syntax in old versions of MySQL

2007-09-20 Thread King Simon-NFHD78
Hi, The ancient version of MySQL that I am connecting to (3.23.58) doesn't support the syntax 'LIMIT limit OFFSET offset' syntax. Instead, it uses LIMIT offset, limit. This is described in the docs, but it doesn't say what version introduced the more standard syntax:

[sqlalchemy] Re: one-to-many access and modification

2007-10-02 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ken Pierce Sent: 29 September 2007 00:21 To: sqlalchemy Subject: [sqlalchemy] one-to-many access and modification Hello all, I just got into using sqlalchemy today and I have a

[sqlalchemy] Re: Please add some __len__ methods

2007-10-22 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of klaus Sent: 22 October 2007 11:33 To: sqlalchemy Subject: [sqlalchemy] Please add some __len__ methods Hi all, I wonder why some classes/objects implement part of a list interface -

[sqlalchemy] Re: access mapped object attributes

2007-11-06 Thread King Simon-NFHD78
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

<    1   2   3