[sqlalchemy] Fwd: [elixir] sqlite3.OperationalError: Could not decode to UTF-8 column

2007-12-05 Thread Gaetan de Menten
Anybody knows about this? -- Forwarded message -- From: Mitch [EMAIL PROTECTED] Date: Dec 5, 2007 1:06 AM Subject: [elixir] sqlite3.OperationalError: Could not decode to UTF-8 column To: SQLElixir [EMAIL PROTECTED] Apologies in advance if this should be sent to the SQLAlchemy

[sqlalchemy] Re: Fwd: [elixir] sqlite3.OperationalError: Could not decode to UTF-8 column

2007-12-05 Thread Michael Bayer
he needs to supply data to the DB as python unicode objects..the strings from the file should be decoded first from ISO-8859. if he wants to sqlite's text_factory feature, he can use a custom connection function described in

[sqlalchemy] Re: Slow relation based assignment.

2007-12-05 Thread Martin Pengelly-Phillips
Thank you Michael - I had completely missed the backref full load. On Dec 5, 5:27 pm, Michael Bayer [EMAIL PROTECTED] wrote: hi martin - the issue is that each Tag object contains a collection of 1000 employees on it, and when you make an assignment in the forwards direction (i.e.

[sqlalchemy] Re: Fwd: [elixir] sqlite3.OperationalError: Could not decode to UTF-8 column

2007-12-05 Thread Mitch
On Dec 5, 8:00 am, Michael Bayer [EMAIL PROTECTED] wrote: he needs to supply data to the DB as python unicode objects..the strings from the file should be decoded first from ISO-8859. Thanks for the help. After some experimentation I found that encoding all string data to UTF-8, ignoring

[sqlalchemy] Filling foreign key with mapping

2007-12-05 Thread paftek
Hi, Sorry for this meaningless subject ! I am learning SQLAlchemy and I installed version 0.4.1 few days ago. My problem is probably easy to solve. I swear I have read a good part of the documentation, and searched this group ! But... Short example. Two tables : - languages having a sequence

[sqlalchemy] order_by on related table

2007-12-05 Thread David Gardner
I have three tables a(a query of a really), b, c a has a 1-many relationship with b c has a 1-many relationship with b What I would like to do is in my mapper for table c, is sort the order of rows from b by a.name. I don't know how to do this or if it is possible. What I have looks like:

[sqlalchemy] Re: SQLAlchemy 0.4.1 example vertical.py not working

2007-12-05 Thread Michael Bayer
it appears to have broken since the session adjustments in 0.4.1. it should work in 0.4.0 for now. On Dec 5, 2:05 pm, paftek [EMAIL PROTECTED] wrote: Using Python 2.5.1, I can not get this example to work :http://svn.sqlalchemy.org/sqlalchemy/tags/rel_0_4_1/examples/vertical... It crashes

[sqlalchemy] SQLAlchemy 0.4.1 example vertical.py not working

2007-12-05 Thread paftek
Using Python 2.5.1, I can not get this example to work : http://svn.sqlalchemy.org/sqlalchemy/tags/rel_0_4_1/examples/vertical/vertical.py It crashes with : Traceback (most recent call last): File vertical.py, line 161, in module session.save(entity3) ...

[sqlalchemy] Re: Filling foreign key with mapping

2007-12-05 Thread David Gardner
I believe what you need to do is get an instance of a language object something like: item.Language = session.query(Language).filter_by(name='en').first() There maybe a better way to do this, but its how I currently do it (so if there is a better way I would like to know). paftek wrote: Hi,

[sqlalchemy] distinct entries when mapping many-to-many

2007-12-05 Thread MattQc
I am mapping 3 tables linearly. The first 2 have a many-to-many relation and the last one is a one-to-one relation. I would like to get all the distinct entries from the third table. I was not able to figure how to do the mapping. So, I tried by doing my own set of entries outside of SA but when

[sqlalchemy] Re: Slow relation based assignment.

2007-12-05 Thread Michael Bayer
hi martin - the issue is that each Tag object contains a collection of 1000 employees on it, and when you make an assignment in the forwards direction (i.e. employee.tag.append(sometag)), the corresponding reverse relation needs to be fully loaded and then updated according to backref semantics.

[sqlalchemy] Re: order_by on related table

2007-12-05 Thread Michael Bayer
On Dec 5, 2007, at 1:56 PM, David Gardner wrote: I have three tables a(a query of a really), b, c a has a 1-many relationship with b c has a 1-many relationship with b What I would like to do is in my mapper for table c, is sort the order of rows from b by a.name. I don't know how to

[sqlalchemy] Slow relation based assignment.

2007-12-05 Thread Martin Pengelly-Phillips
Hello again, I have recently noticed that a particular assignment seems to be taking a relatively long time. Not being a database expert I am confused as to whether the last assignment 'person.tags = tags' should be so slow when referencing existing tags that are used by other entities - it

[sqlalchemy] delete children of object w/o delete of object?

2007-12-05 Thread kris
with sqlalchemy 0.4.1, Is there an idiom for delete the children of the object without actually deleting the object itself? I tried session.delete (obj) session.flush() # add new children session.save (obj) session.flush() But it gave me the error InvalidRequestError: Instance '[EMAIL

[sqlalchemy] Re: SQLAlchemy 0.4.1 example vertical.py not working

2007-12-05 Thread Michael Bayer
the example is repaired in rev 3856 of the SVN trunk. it just uses a contextual session now. On Dec 5, 2007, at 2:05 PM, paftek wrote: Using Python 2.5.1, I can not get this example to work : http://svn.sqlalchemy.org/sqlalchemy/tags/rel_0_4_1/examples/vertical/vertical.py It crashes

[sqlalchemy] Re: order_by on related table

2007-12-05 Thread David Gardner
Michael thanks for the help, this is how I was able to get it working. Probably isn't the most efficient, but it works, I couldn't implement it the way you proposed because I still need to be able to do a_row = b_row.A - sql_b = select([b_table, sql_a.c.name], b_table.c.a_id =