[sqlalchemy] Re: Automatic generation of changelog

2007-03-28 Thread Gaetan de Menten
On 3/29/07, Arnar Birgisson <[EMAIL PROTECTED]> wrote: > > Thank you very much, seems I should be able to do what I want. I'll > take a stab at it tomorrow and report. If you could post your code somewhere, it would be greatly appreciated since I know I'll need to do approximately the same thing

[sqlalchemy] Re: Latests unicode changes breaking MSSQL

2007-03-28 Thread Rick Morrison
...and it's affected my spelling, too! On 3/28/07, Rick Morrison <[EMAIL PROTECTED]> wrote: > > Mike, I'm seeing som breaking of MSSQL / pymssql that I think might be > caused by the latest unicode stuff. > The statements themselves are beginning to be issued in unicode when a > query is construct

[sqlalchemy] Latests unicode changes breaking MSSQL

2007-03-28 Thread Rick Morrison
Mike, I'm seeing som breaking of MSSQL / pymssql that I think might be caused by the latest unicode stuff. The statements themselves are beginning to be issued in unicode when a query is constructed in the ORM. Where is an appropriate place for the dialect to intercept the call to the DB-API just

[sqlalchemy] Re: Automatic generation of changelog

2007-03-28 Thread Michael Bayer
On Mar 28, 2007, at 6:07 PM, Arnar Birgisson wrote: > > Hi Dave, > > Thank you very much, seems I should be able to do what I want. I'll > take a stab at it tomorrow and report. > > On 3/28/07, Michael Bayer <[EMAIL PROTECTED]> wrote: >> note that by "history", we mean things that have occured s

[sqlalchemy] Re: UOW relation delete bug

2007-03-28 Thread Rick Morrison
yikes, you're right - fixed in rev 2458. thanks for having a look. On 3/28/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > are you sure thats right ? ClauseParameters doesnt have any kind of > "__getattr__" logic going oni think the test you have there would return > False in all cases. ar

[sqlalchemy] Re: [PATCH] Using entry points to load database dialects

2007-03-28 Thread Michael Bayer
ok anyway, im behind on patches (which i like to test and stuff) so ive added ticket 521 to my "in queue" list. if youd like to add a short unit test script that would be handy (otherwise we might not have test coverage for the setuptools portion of the feature). On Mar 28, 12:26 pm, Monty Taylo

[sqlalchemy] Re: Automatic generation of changelog

2007-03-28 Thread Arnar Birgisson
Hi Dave, Thank you very much, seems I should be able to do what I want. I'll take a stab at it tomorrow and report. On 3/28/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > note that by "history", we mean things that have occured since the > instance was loaded from the database into the current s

[sqlalchemy] Re: Automatic generation of changelog

2007-03-28 Thread Michael Bayer
dont have an example handy, but yeah youd want to make a MapperExtension and work into the after_insert(), after_update() and after_delete() hooks (or maybe the before_ versions of each one, depending on how you detect changes). you can issue writes to the database immediately within those and th

[sqlalchemy] Automatic generation of changelog

2007-03-28 Thread Arnar Birgisson
Hi there, I have an old system that I'm porting over to SA. In the old system there is one entity that keeps a change history of itself. In the code that performs db updates, the current state of the object is examined and before it is updated I insert rows to a table with colums like this: obje

[sqlalchemy] Re: Legacy DB Migration Strategy - How to question?

2007-03-28 Thread Paul Johnston
Hi, >New user here trying to get started - I'd like to create an ORM map >from an existing legacy (SQL Server) database - although I may convert >this to Postgres or MySQL. > > If you just want to get going, SQLSoup is probably your best bet. If you're serious about making a long-term move to

[sqlalchemy] Re: func() bug ?

2007-03-28 Thread Paul Johnston
Hi, >any(:any) = :a_1 >it should be :a_1 = any(:any) > > This looks like odd Postgres behaviour, the equals operator not quite being commutative. We could add a Postgres-specifc workaround, in PGCompiler something like (untested): def visit_binary(self, binary): if isinstance(bi

[sqlalchemy] Re: UOW relation delete bug

2007-03-28 Thread Michael Bayer
I doubt theres any performance difference if the DBAPI does the right thing with a prepared statement. also, IN() wont work too well if the rows are targeted by more than just one column; plus it generally limits to 1000 elements and presents a larger and non-consistent string to the DB wh

[sqlalchemy] Re: UOW relation delete bug

2007-03-28 Thread Rick Morrison
Working now... Anyway, wouldn't this operation be a lot more efficient using IN() instead of executemany()? Is detecting that too hard? Rick On 3/28/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > it works for me, the bind params are in sqlite: > > [[1], [3], [5]] > > in postgres: > > [{'id'

[sqlalchemy] Re: UOW relation delete bug

2007-03-28 Thread Michael Bayer
are you sure thats right ? ClauseParameters doesnt have any kind of "__getattr__" logic going oni think the test you have there would return False in all cases. are you sure you dont mean: self.IINSERT = tbl.has_sequence.key in parameters[0] has_key() has been removed in favor of just _

[sqlalchemy] Re: func() bug ?

2007-03-28 Thread Julien Cigar
ok it works with literal() :-) Thanks On Wed, 2007-03-28 at 12:04 -0400, Michael Bayer wrote: > a few things here. > > first of all, if its an operator, you probably want to use op(): > > literal('foo').op('ANY')('bar') > > secondly, when you say "x" == , the __eq__() method in > Python that

[sqlalchemy] Re: Fix on ADODBAPI

2007-03-28 Thread Rick Morrison
You're looking in the wrong place: that's the code for pymssql. Try rev 2457; I just committed a fix for this. Rick On 3/28/07, El Gringo <[EMAIL PROTECTED]> wrote: > > > > > On 28 mar, 12:30, Paul Johnston <[EMAIL PROTECTED]> wrote: > > Hi, > > > > The bit applicable toadodbapidoesn't consider

[sqlalchemy] Re: UOW relation delete bug

2007-03-28 Thread Rick Morrison
The MSSQL module examines the parameter object, looking for whether or not the query being executed has an explicit primary key on an autoincrementing column. Inserting those things in MSSQL is a special mode (don't get me started on how goofy that is...). The code was using "key in parmobject" to

[sqlalchemy] Re: mssql using pymssql 0.8 and sqlalchemy 0.3.6

2007-03-28 Thread Rick Morrison
As far as I know a view is treated like a table in SA - if you're getting the query to run at all, it's most likely that SA is issuing a different query that what you thought it might. Either use the SQL profiler in MSSQL to see the actual SQL going over the wire, or turn on logging in SA to see w

[sqlalchemy] Re: mssql using pymssql 0.8 and sqlalchemy 0.3.6

2007-03-28 Thread Lee Connell
pyodbc seems to do the trick. Thanks for the recommendation. I am having problem selecting from views in ms sql database, it returns 0 rows, using the same statement in enterprise manager returns a bunch of rows. Is there anything special I need to do for selecting data from views? On Mar 28,

[sqlalchemy] Re: sqlalchemy orm doesn't create an instance of certain rows

2007-03-28 Thread Michael Bayer
the issue is that the built-in relationship joining facilities dont know how to generate joins for self-referential relationships that you could then reference externally in your criterion. while its easy enough for the join to add in an "alias" there, all subsequent operations on the quer

[sqlalchemy] Re: UOW relation delete bug

2007-03-28 Thread Rick Morrison
Hey Mike, this looks to be related to the parameters-as-ClauseParameters instead of Python dict() on a different thread. I'm going to need some help or advice beating the MSSQL module into shape with the new convention. Where does the positional / non-positional specification go? I don't see it in

[sqlalchemy] Re: UOW relation delete bug

2007-03-28 Thread Michael Bayer
On Mar 28, 1:15 pm, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > Hey Mike, this looks to be related to the parameters-as-ClauseParameters > instead of Python dict() on a different thread. you mean the thing i just checked in yesterday ? OK yeah, youve always been getting a ClauseParameters obj

[sqlalchemy] Re: Confused by foreign_keys argument

2007-03-28 Thread Michael Bayer
On Mar 28, 1:01 pm, "King Simon-NFHD78" <[EMAIL PROTECTED]> wrote: > That compiles and appears to run in the small test program attached, but > if you look at the query generated when accessing the 'cs' property, it > doesn't actually use the join condition: > > SELECT c.id AS c_id, c.name AS c_

[sqlalchemy] Re: Confused by foreign_keys argument

2007-03-28 Thread King Simon-NFHD78
That compiles and appears to run in the small test program attached, but if you look at the query generated when accessing the 'cs' property, it doesn't actually use the join condition: SELECT c.id AS c_id, c.name AS c_name FROM c, a_b, b_c WHERE ? = a_b.a_id AND b_c.c_id = c.id ORDER BY a_b.oid

[sqlalchemy] Re: mssql using pymssql 0.8 and sqlalchemy 0.3.6

2007-03-28 Thread Rick Morrison
DBlib is deprecated by MS, and it hasn't been updated in like five years, and is just never going to be updated ever. If you can't change the name of the database, then I would take a look at replacing pymssql with pyodbc, I have heard of people having good luck with it (Paul, want to jump in here

[sqlalchemy] Re: mssql using pymssql 0.8 and sqlalchemy 0.3.6

2007-03-28 Thread Lee Connell
There is a fix for column names, however I don't see anything to overcome this issue if the database name is more than 30 chars? Any suggestions? On Mar 28, 12:44 pm, "Lee Connell" <[EMAIL PROTECTED]> wrote: > the table I'm trying to grab is under 30 chars. Is there a way to > change this limit

[sqlalchemy] Re: mssql using pymssql 0.8 and sqlalchemy 0.3.6

2007-03-28 Thread Lee Connell
the table I'm trying to grab is under 30 chars. Is there a way to change this limit? On Mar 28, 12:23 pm, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > Pymssql uses DBlib under the covers, and > there's a 30-character identifier limit in DBlib. > > That limit applies to any identifier, including

[sqlalchemy] Re: [PATCH] Using entry points to load database dialects

2007-03-28 Thread Monty Taylor
Michael Bayer wrote: > dialects can be used on their own without the engine being present > (such as, to generate SQL), also you can construct an engine passing > in your own module object which might have been procured from > somewhere else (or could be a mock object,for example). Ok, yes

[sqlalchemy] Parameters changed?

2007-03-28 Thread Rick Morrison
Hey Mike did the "parameters" argument to ExecutionContent.pre_exec() recently change form? Looks like it changed from a Python dict to "ClauseParameters" object? Thx, Rick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

[sqlalchemy] Re: mssql using pymssql 0.8 and sqlalchemy 0.3.6

2007-03-28 Thread Rick Morrison
Pymssql uses DBlib under the covers, and there's a 30-character identifier limit in DBlib. That limit applies to any identifier, including table and column names, which might explain your second issue. Rick On 3/28/07, Lee Connell <[EMAIL PROTECTED]> wrote: > > > I am using these tools on a win

[sqlalchemy] Re: Confused by foreign_keys argument

2007-03-28 Thread Michael Bayer
what it cant locate are foreign keys between the parent and child tables, "a" and "c"because there arent any. when you have a many- to-many, the rules for figuring out the relationship change, and it knows to do that by the presence of the "secondary" argument. so if you can manufacture

[sqlalchemy] mssql using pymssql 0.8 and sqlalchemy 0.3.6

2007-03-28 Thread Lee Connell
I am using these tools on a windows machine. Some problems I ran into. First of all I can't connect to a database that's name is more than 30 chars long. Error returned says it can't find the database and the database it's looking for has been truncated. When I connect to a database less than

[sqlalchemy] Re: func() bug ?

2007-03-28 Thread Michael Bayer
a few things here. first of all, if its an operator, you probably want to use op(): literal('foo').op('ANY')('bar') secondly, when you say "x" == , the __eq__() method in Python that gets called on the clauseelement has no "reversed" version. so its impossible for the ClauseElement on the

[sqlalchemy] Re: postgres and unicode

2007-03-28 Thread Michael Bayer
On Mar 28, 2007, at 5:38 AM, Andreas Jung wrote: > > > --On 28. März 2007 13:34:47 +0400 Denis Shaposhnikov <[EMAIL PROTECTED]> > wrote: > >> >> Hi! >> >> I have postgresql database created with utf-8 encoding. But SA >> give me >> back 'strings' instead of u'strings' for String columns. Is

[sqlalchemy] Confused by foreign_keys argument

2007-03-28 Thread King Simon-NFHD78
Hi, I don't think I understand exactly what I'm supposed to pass to the foreign_keys parameter to relation. I'm trying to set up a 1-to-many viewonly relation, with no backref, where there are two intermediate tables between the parent table and the child. To complicate things further, I need to

[sqlalchemy] Re: func() bug ?

2007-03-28 Thread Julien Cigar
Hello Mike, This simple test illustrate the problem : >>> from sqlalchemy import func >>> print 'foo' == func.any('bar') any(:any) = :a_1 it should be :a_1 = any(:any) If you look at the PostgreSQL documentation, http://www.postgresql.org/docs/8.2/static/functions-comparisons.html#AEN14105 th

[sqlalchemy] Re: Fix on ADODBAPI

2007-03-28 Thread El Gringo
On 28 mar, 12:30, Paul Johnston <[EMAIL PROTECTED]> wrote: > Hi, > > The bit applicable toadodbapidoesn't consider the port at all (at the > moment...) > Check the current trunk, if port is specified, the port key is deleted and its value added to the key host with ''.join([keys.get('host', '')

[sqlalchemy] Re: Fix on ADODBAPI

2007-03-28 Thread Paul Johnston
Hi, The bit applicable to adodbapi doesn't consider the port at all (at the moment...) class MSSQLDialect_adodbapi(MSSQLDialect): ... def make_connect_string(self, keys): connectors = ["Provider=SQLOLEDB"] connectors.append ("Data Source=%s" % keys.get("host")) c

[sqlalchemy] Re: postgres and unicode

2007-03-28 Thread Andreas Jung
--On 28. März 2007 13:34:47 +0400 Denis Shaposhnikov <[EMAIL PROTECTED]> wrote: Hi! I have postgresql database created with utf-8 encoding. But SA give me back 'strings' instead of u'strings' for String columns. Is it right or I have to always use ``convert_unicode=True`` for `BoundMetaData(

[sqlalchemy] postgres and unicode

2007-03-28 Thread Denis Shaposhnikov
Hi! I have postgresql database created with utf-8 encoding. But SA give me back 'strings' instead of u'strings' for String columns. Is it right or I have to always use ``convert_unicode=True`` for `BoundMetaData()`? Thank you! -- DSS5-RIPE DSS-RIPN 2:550/[EMAIL PROTECTED] 2:550/[EMAIL PROTEC