[sqlalchemy] SA and pyodbc connections

2007-06-06 Thread scurra
Hi I cannot connect to SQL Server 2005 (Express) from my linux box using the suggested SA method. I can connect to SQL Server using sqsh which indicates that freetds and unixodbc are correctly set up. I can also connect using pyodbc. Although, only with the DSN method or with DRIVER={}. For

[sqlalchemy] Query generation in 0.3.8 is broken?

2007-06-06 Thread [EMAIL PROTECTED]
Hi there. I have just mirgated to 0.3.8 from 0.3.6 and got the followin error in my app: class 'sqlalchemy.exceptions.NoSuchColumnError' Investigation shows, that queries generated in 0.3.6 and 0.3.8 are differ: (diff, i changed all spaces to line breaks before): --- 1 2007-06-06

[sqlalchemy] Re: Accessing tables in multiple databases with one connection (MSSQL)

2007-06-06 Thread Rick Morrison
MSSQL has a history of confusion about what is owner and what is schema, and there has been shifting back and forth over the years as they tried to decide if they wanted to be like Oracle, or like Sybase. Recently the 2005 version added real schemas as well, so a table identifier can I believe

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread svilen
on a side note, here or for the query(), once i add .order_by() and similar, will be a possibility to remove/cancel them? e.g. .order_by(None) - similar to .join(None)? or should i keep a copy at the point before adding .order_by()? e.g. i want: q1 = query.filter( ...).order_by(z)#the

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Marco Mariani
svilen ha scritto: on a side note, here or for the query(), once i add .order_by() and similar, will be a possibility to remove/cancel them? e.g. .order_by(None) - similar to .join(None)? or should i keep a copy at the point before adding .order_by()? e.g. i want: q1 = query.filter(

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread svilen
svilen ha scritto: on a side note, here or for the query(), once i add .order_by() and similar, will be a possibility to remove/cancel them? e.g. .order_by(None) - similar to .join(None)? or should i keep a copy at the point before adding .order_by()? e.g. i want: q1 =

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Marco Mariani
svilen ha scritto: because q1 with the order is _the_ query, made at point A somewhen, and stored there as a construct; much later at some point B i need to use that query but without the ordering - now i have to keep 2 copies of the query, w/ and w/out order. And this strip-the-ordering

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Rick Morrison
Beyond the API littering, there may be instances where it is difficult or impossible to remove a query attribute, because adding the attribute caused a join calculation or reordered parenthesis, or whatever. The second pattern is better, e.g. save a copy, rather than mucking things up with

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread svilen
it's not about littering API / namespaces or not, but if u percieve it just as such... nevermind. i admit that undoing some change can be difficult or just impossible in certain cases. So i'll do a sort of command pattern then, keeping intermediate queries. Forget that i asked. Beyond the

[sqlalchemy] Re: In Turbogears, using the same transaction for mapped objects and direct operations

2007-06-06 Thread Sanjay
conn = session.context.get_current().connection(SomeMappedClass) conn.execute(...) Thanks! It is exactly what I needed. BTW, the session transaction is stored in cherrypy.request.sa_transaction. Does this help simplify the statements? thanks again, Sanjay

[sqlalchemy] Re: like doesn't work with objects

2007-06-06 Thread Techniq
On Jun 6, 12:37 am, Mike Orr [EMAIL PROTECTED] wrote: On 6/5/07, Techniq [EMAIL PROTECTED] wrote: I'm going through the wiki cookbook http://docs.pythonweb.org/display/pylonscookbook/SQLAlchemy+for+peopl... and I'm discovering that even though 'model.class.c.column_name.like' is

[sqlalchemy] Re: Query generation in 0.3.8 is broken?

2007-06-06 Thread Michael Bayer
can you send me full Table/Mapper/class constructs, running against sqlite://, so i can run this example, thanks. On Jun 6, 2007, at 8:30 AM, [EMAIL PROTECTED] wrote: To be more precise, the code: j = outerjoin( task_t, message_t, task_t.c.id==message_t.c.task_id) jj = select([

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Michael Bayer
On Jun 5, 2007, at 10:30 PM, Mike Orr wrote: I do think .append_whereclause should be changed to .append_to_where. A SQL statement can have only one WHERE clause; what you're actually appending is an AND operand. .append_to_where seems to get that across better than .append_whereclause or

[sqlalchemy] UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
For reference: http://www.mail-archive.com/[EMAIL PROTECTED]/msg02239.html I found the above discussion when googling a ProgrammingError i've been getting with a polymorphic_union: quote sqlalchemy.exceptions.SQLError: (ProgrammingError) UNION types numeric and character varying cannot be

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Eric Ongerth
On Jun 6, 8:32 am, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 5, 2007, at 10:30 PM, Mike Orr wrote: I do think .append_whereclause should be changed to .append_to_where. A SQL statement can have only one WHERE clause; what you're actually appending is an AND operand. .append_to_where

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Rick Morrison
Yeah, I'm +1 on .where() as well. On 6/6/07, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 5, 2007, at 10:30 PM, Mike Orr wrote: I do think .append_whereclause should be changed to .append_to_where. A SQL statement can have only one WHERE clause; what you're actually appending is an

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Michael Bayer
On Jun 6, 2007, at 11:32 AM, Eric Ongerth wrote: So, skis are working fine but skiboots aren't. If I either comment out the 'size' column in the skiboots table: # Column('size', types.Numeric(3,1)), - or - comment out the 'skiboots' line in the item_join: #

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Michael Bayer
just to note, I am leaning towards very simple generative method names for all the things we need, where(), having(), order_by(), group_by(), distinct(), etc. I am going to have it do copy on generate by default. the copy operation itself will be pretty quick, working the way I have it

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Mike Orr
.where() is OK. On 6/6/07, svilen [EMAIL PROTECTED] wrote: q2 = q1.order_by(None)#used sometimes e.g. for count This would be useful. If a second .order_by can replace the ordering (as opposed to appending to it), I don't see why it would be difficult to delete it. .order_by shouldn't

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
So then I thought: maybe I just need to reflect the skiboots table and override the size column to the desired type? That would make sense... so I tried it, using the same script as above but adding the line autoload=True as the final clause in each Table definition. Now i'm getting a

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
oops, sorry -- I was adding my reply while you were still writing yours. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread Mike Orr
On 6/6/07, Michael Bayer [EMAIL PROTECTED] wrote: just to note, I am leaning towards very simple generative method names for all the things we need, where(), having(), order_by(), group_by(), distinct(), etc. I am going to have it do copy on generate by default. If a generative default can

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
On Jun 6, 8:47 am, Michael Bayer [EMAIL PROTECTED] wrote: your size column differs in type. you cant create a UNION with differing types in the unioned queries. so it can either be both string, both numeric, or use distinct columns. Ah! Ok, if i was more experienced with unions/joins I

[sqlalchemy] Re: Generative style on SQL-API layer

2007-06-06 Thread svilen
While those who prefer the latter can do that, and if you really need a copy: q = q.clone().order_by(...) explicit is better than implicit is one rule that may apply here. Not that i enslave myself with those rules but they do make sense in most cases in the long-run. Michael, u hold

[sqlalchemy] Re: SA and pyodbc connections

2007-06-06 Thread scurra
Hi Paul Thanks for the advice. I have checked out the subversion SQLAlchemy, made the change to mssql.py, and run the unit tests. 648c648 connectors = [Driver={SQL Server}] --- connectors = [DRIVER={}] src/sqlalchemy$ python test/alltests.py --dburi='mssql:// ryant:[EMAIL

[sqlalchemy] Re: In Turbogears, using the same transaction for mapped objects and direct operations

2007-06-06 Thread Marco Mariani
Sanjay ha scritto: BTW, the session transaction is stored in cherrypy.request.sa_transaction. Yes, but it's been added recently. Does this help simplify the statements? Transaction instances have a connection() property. So, cherrypy.request.sa_transaction.connection should work.

[sqlalchemy] Re: SA and pyodbc connections

2007-06-06 Thread Rick Morrison
I'm interested in the results too, as well as the ODBC config. I'm still in the process of setting up a buildbot slave on Ubuntu that's going to be running pyodbc as well. I normally use pymssql, and it'll be my first serious go with pyodbc. If it's OK with the list, maybe you can post the

[sqlalchemy] Re: SA and pyodbc connections

2007-06-06 Thread Paul Johnston
Hi, src/sqlalchemy$ python test/alltests.py --dburi='mssql:// ryant:[EMAIL PROTECTED]/testdb' --verbose --coverage | tee -a sqlaut.log Try this command line: python test/alltests.py --dburi='mssql://ryant:[EMAIL PROTECTED]/testdb?text_as_varchar=1' sqlaut.log 21 If you could mail the

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
Yeah. My problem has been solved by altering the tables... skiboots.c.size is now skiboots.c.skiboot_size, and skis.c.size is now skis.c.ski_size. Is there a way I could avoid that, making use of the use_labels=True parameter on select()? I've been trying to work out how to rewrite my

[sqlalchemy] Re: Query generation in 0.3.8 is broken?

2007-06-06 Thread [EMAIL PROTECTED]
I have just submitted the ticket #523, there is a minimalistic code snippet, wich reproduces the error. I am sorry that I did not sent the working example right in ticket #592, but I could not reproduce it. But not I did (see below, or ticket #523): The problem appears when mapper, relations

[sqlalchemy] Re: Column name mapping problem in 0.3.7

2007-06-06 Thread Graham Stratton
I'm bringing this old thread up because I'm still having the same issue with 0.3.8. In order to use mssql I have to add def max_identifier_length(self): return 30 to the pymssql dialect. I also find that I need to set has_sane_rowcount=False (as I have had to with every

[sqlalchemy] Re: Column name mapping problem in 0.3.7

2007-06-06 Thread Rick Morrison
Hi Graham, There's a good chance that only you and I are using pymssql, and I don't have have the long identifiers problem, so it kind of dropped throught the cracks, sorry. I've checked in the 30-character thing, but I've left off the sane_rowcount for now. I had run into issues with that back

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Michael Bayer
On Jun 6, 2007, at 11:58 AM, Eric Ongerth wrote: So then I thought: maybe I just need to reflect the skiboots table and override the size column to the desired type? That would make sense... so I tried it, using the same script as above but adding the line autoload=True as the final

[sqlalchemy] Re: Query generation in 0.3.8 is broken?

2007-06-06 Thread Michael Bayer
do me several huge favors: - do not redefine j three times, ss and tsk_count_join two times, etc. Particuilarly i have no idea which j join you actually would like to use. define the individual clauses youd like to use once, then use that same instance. to SQLAlchemy, two identical

[sqlalchemy] Re: SA and pyodbc connections

2007-06-06 Thread scurra
Hi Paul src/sqlalchemy$ python test/alltests.py --dburi='mssql:// ryant:[EMAIL PROTECTED]/testdb' --verbose --coverage | tee -a sqlaut.log Try this command line: python test/alltests.py --dburi='mssql://ryant:[EMAIL PROTECTED]/testdb?text_as_varchar=1' sqlaut.log 21 If you could mail

[sqlalchemy] Re: Query generation in 0.3.8 is broken?

2007-06-06 Thread Dmitry Zuikov
Well, Sorry, I just copy-pasted it from real code, trying to get minimal example. I was in rush. I do not really use clear_mapper, just put it there to demostrate how it fails. Here the more clean code (or you may download it from http://dzuikov2.firstvds.ru/qqq.py) #!/usr/bin/env python

[sqlalchemy] Re: Mapping existing structure of a database

2007-06-06 Thread Paul Johnston
Hi, What kind of overhead is associated with using the autoload flag? Quite high, although not a problem if a long running app only does it at startup. Is there a way to dump the structure of a database to a file and import this as a kind of module? There is, although it's very basic

[sqlalchemy] Re: Mapping existing structure of a database

2007-06-06 Thread Paul Johnston
Hi, What kind of overhead is associated with using the autoload flag? Quite high, although not a problem if a long running app only does it at startup. Is there a way to dump the structure of a database to a file and import this as a kind of module? There is, although it's very basic

[sqlalchemy] group_by and column labels

2007-06-06 Thread Huy Do
Hi, I am trying to reuse my column list in my group by clause but some of my columns use label() which is causing a sql syntax error because of the column as label in the group by clause. Is it possible to get the group_by to only use the label side of a column . eg. (This doesn't work

[sqlalchemy] Re: Query generation in 0.3.8 is broken?

2007-06-06 Thread Michael Bayer
the queries generated in 0.3.6 and 0.3.8 are identical except for an anonymous alias name. they are also both incorrect, and its only because 0.3.6 is less accurate about targeting Column objects in result sets that it works. the task_id column which youve labeled inside of jj does not

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Michael Bayer
On Jun 6, 2007, at 12:49 PM, Eric Ongerth wrote: Yeah. My problem has been solved by altering the tables... skiboots.c.size is now skiboots.c.skiboot_size, and skis.c.size is now skis.c.ski_size. Is there a way I could avoid that, making use of the use_labels=True parameter on select()?

[sqlalchemy] Postgres MD Auth

2007-06-06 Thread Techniq
Any reason why I can auth with psql and not the sqlachemy.dburi in Pylons? I can see that the user, password, host, port are all passed correctly. These are the same parameters I use with psql to connect. I'm connecting from the same machine in both cases. psql -U username -h ip address

[sqlalchemy] Re: UNION types x and y cannot be matched

2007-06-06 Thread Eric Ongerth
Thanks for your responses, Mike. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to