[sqlalchemy] Re: SQLAlchemy 0.5.4 Released

2009-05-18 Thread Alexandre Conrad
Mike, Woooh ! it all sounds sounds great ! I was thinking that it would be nice to have an up-to-date version of your post you did a while back: http://techspot.zzzeek.org/?p=17 I know such a task takes time but it would be fun to see the results. That would keep SA's marketing in shape (even

[sqlalchemy] Multiple self-referential relations

2009-05-18 Thread Wichert Akkerman
I am building a tree datastructure using parent pointers. The only differece from a standard adjancancy list is that I can have multiple trees, each identified by a root session node. In order to be allow fast queries each tree node has a pointer to the session id (ie the root node).

[sqlalchemy] Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread fleong
I am trying to configure the following relationships: table1 -1---N- table2 ___|___- type | | table_ex22 1--N- table21 table22 paste my code here. When relate a instance of Table22 with the

[sqlalchemy] Re: SQLAlchemy 0.5.4 Released

2009-05-18 Thread Francesca Leon
Hi Michael I just downloaded version 0.5.4 of SqlAlchemy. I would like to signal just a small detail that seems to make my tests fail: [...] File C:\Python25\lib\site-packages\sqlalchemy-0.5.4-py2.5.egg\sqlalchemy\orm\attributes.py, line 379, in get return self.get(state,

[sqlalchemy] Newbie anti hacker question.

2009-05-18 Thread Douglas E
I just started using SQL and SQLAlchemy 2 days ago. I don't know SQL or Alchemy very well yet but this is all the code I will ever need (at least for a while). This is my python code for the server. Have I done this well? What more could I do? What more can I do to make it hacker/cracker proof?

[sqlalchemy] Re: SQLAlchemy 0.5.4 Released

2009-05-18 Thread Puzzle Stone
Great, cheers.Let's update SQLAlchemy to 0.5.4 for the performance enhancement. On Mon, May 18, 2009 at 9:20 AM, Michael Bayer mike...@zzzcomputing.comwrote: Hello list - SQLAlchemy 0.5.4 is released, and this release is *highly* recommended for all users.For an indication of how high,

[sqlalchemy] Getting str value when I want unicode

2009-05-18 Thread zugnush
There seem to be a lot of people getting unicode when they want str. I want unicode, I've tried to force it with the connection parameters. I get it for the column heading but not the value. Can anyone explain to me what I'm doing wrong. Thanks Neil In [121]: import sqlalchemy In [122]:

[sqlalchemy] Re: SQLAlchemy 0.5.4 Released

2009-05-18 Thread Francesca Leon
Sorry, here it is: Traceback (most recent call last): File "C:\dex\python\dex\tests\adrims\TestDataBase.py", line 973, in testMerge_SomethingThatNeverExisted self.session.flush() File "c:\python25\lib\site-packages\SQLAlchemy-0.5.4-py2.5.egg\sqlalchemy\orm\session.py", line 1354, in flush

[sqlalchemy] Re: SQLAlchemy 0.5.4 Released

2009-05-18 Thread Michael Bayer
thanks, this is fixed in r5970 and I may release 0.5.4p1 today. On May 18, 2009, at 11:54 AM, Francesca Leon wrote: Sorry, here it is: Traceback (most recent call last): File C:\dex\python\dex\tests\adrims\TestDataBase.py, line 973, in testMerge_SomethingThatNeverExisted

[sqlalchemy] Postgres not loading values into db

2009-05-18 Thread scrapbooker
Hello, My code seems to operating fine, loading some values into a Postgres 8.1 database using sqlalchemy 0.4.7 in Debian Lenny. The first 2 tables load fine into Postgres, but on the third looking at the logs (see below), something strange happens. sqlalchemy passes in the column values

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread Michael Bayer
have you tried not using 0 for a primary key ? i feel like that might be getting in the way. On May 18, 2009, at 3:59 PM, fleong wrote: Sorry for the delay. Yes, i want to reference Table22, the 'correct' code is as follows, but obtains the same result. Don't understand because not run

[sqlalchemy] Re: Postgres not loading values into db

2009-05-18 Thread scrapbooker
On May 18, 12:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: can you create a test case which reproduces ? Michael, yes, I'll create a test case which simplifies the issues. It's definitely not a Postgres issue, but rather how I'm managing the Session, dependencies, or the like.

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread fleong
0 in a numerical primary key.. excuse if it is obvious, but: what's wrong? :/ I've tried and nothing.. when ask for instances that are linked through 't22' get all instances of 'Table2'. There must be something in the relationships configuration involving the entire table.. can it be? On 18

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread Michael Bayer
try taking a look at your SQL output. the issue is pretty obvious, the join condition between your two tables is insufficient to get a T22 row. table_2.id has two rows with 0 for the id column, so joining from table_2 to table_22 on just id gives you two rows. it has nothing to do with

[sqlalchemy] Re: Getting str value when I want unicode

2009-05-18 Thread zugnush
Thanks, I'm still getting a unicode decode error though. C:\Python26\lib\site-packages\sqlalchemy-0.5.2-py2.6.egg\sqlalchemy \types.pyc in process(value) 468 def process(value): 469 if value is not None and not isinstance(value, unicode): -- 470

[sqlalchemy] Re: Getting str value when I want unicode

2009-05-18 Thread Michael Bayer
On May 18, 2009, at 6:17 PM, zugnush wrote: Thanks, I'm still getting a unicode decode error though. C:\Python26\lib\site-packages\sqlalchemy-0.5.2-py2.6.egg\sqlalchemy \types.pyc in process(value) 468 def process(value): 469 if value is not None and

[sqlalchemy] Re: Automatic eager loading

2009-05-18 Thread Michael Bayer
you'd have to roll that yourself. Its generally not feasable for every relation on an object to be eagerloaded since it would create too many joins. On May 18, 2009, at 11:11 AM, Joril wrote: Hi all, is there a way to request at query-time eager loading on every relation involved?

[sqlalchemy] Accessing classes a table away in a mapper

2009-05-18 Thread Nathan Harmston
Hi, I am trying to map a relation in class which allows it to access objects from a couple of tables away ie. class Zone(object): pass class Sentence(object): pass class RawTag(object): pass class ProcessedTag(RawTag): pass mapper(RawTag, tag_table) mapper(Sentence,

[sqlalchemy] Re: Accessing classes a table away in a mapper

2009-05-18 Thread Michael Bayer
On May 18, 2009, at 8:02 PM, Nathan Harmston wrote: Hi, I am trying to map a relation in class which allows it to access objects from a couple of tables away ie. class Zone(object): pass class Sentence(object): pass class RawTag(object): pass class ProcessedTag(RawTag):

[sqlalchemy] Re: Accessing classes a table away in a mapper

2009-05-18 Thread Michael Bayer
On May 18, 2009, at 8:06 PM, Michael Bayer wrote: if you want to make a chained join like that, use just primaryjoin(), dont use secondary, and set viewonly=True. I might be off on the dont use secondary advice. if you do use secondary, secondary is the middle table, so in this case it

[sqlalchemy] Joined table inheritance mapping issues

2009-05-18 Thread Nathan Harmston
Hi, I am playing with the mapping inheritance structures to my database. I have a the following hierarchy: class Tag(object): pass class NormalisedNameTag(Tag): pass class NormalisedPlaceTag(Tag): pass The idea is that a pre-processing step will produce a series of tags and then

[sqlalchemy] Re: Getting str value when I want unicode

2009-05-18 Thread zugnush
Yes, No I'm using oracle. I don't see anything applicable on the wikipage. I tried convert_unicode=True assert_unicode=True but I now believe that both are more about conversion than giving hints on the native db coding. The column in question is varchar2 and the db version is 10.2.0.4.0

[sqlalchemy] Re: Getting str value when I want unicode

2009-05-18 Thread Michael Bayer
more recent versions of cx_oracle know how to return python unicode directly, if you are reading an NVARCHAR column. for VARCHAR, you have to also make sure the NLS_LANG environment variable is set to something like AMERICAN-AMERICA.UTF8 (or wahtevr nationality you are dealing with).

[sqlalchemy] Re: Inheritance problem: how to configure a relation with a child, but without the parent?

2009-05-18 Thread fleong
the foreign key between table2 and their children was wrong.. now works correctly. Thanks for your help! greetings, Fernando table_21 = \ Table( 'table_21', metadata, Column('id2', Integer, primary_key = True), Column('info', String),