[sqlalchemy] Full connection pool close

2009-01-21 Thread Smoke
Hi, I'm not a SQLAchemy expert ( just an average user... ). I have an application that's causing me some problems... It's a monitoring application that connects to a MS Sql Server, so it's always on. Sometimes happens that casualy I have a DBAPIError with pyodbc. The error is something like

[sqlalchemy] Re: passing tuple argument into sqlalchemy.sql.text string

2009-01-21 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Faheem Mitha Sent: 20 January 2009 22:05 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] passing tuple argument into sqlalchemy.sql.text string Hi, I've got a

[sqlalchemy] Re: Full connection pool close

2009-01-21 Thread Michael Bayer
On Jan 21, 2009, at 5:22 AM, Smoke wrote: Hi, I'm not a SQLAchemy expert ( just an average user... ). I have an application that's causing me some problems... It's a monitoring application that connects to a MS Sql Server, so it's always on. Sometimes happens that casualy I have a

[sqlalchemy] INSERT ... ON DUPLICATE KEY UPDATE

2009-01-21 Thread camlost
hello, i'm trying to use sqlalchemy 0.5.1 with python 2.5.4 on windows. and mysql 5.1. the task is simple: to keep fresh information about our servers. i can get a list of server names from AD, get some info about them and insert them into DB using Session.add(). if i run the script for the

[sqlalchemy] Re: INSERT ... ON DUPLICATE KEY UPDATE

2009-01-21 Thread Werner F. Bruhin
camlost wrote: hello, i'm trying to use sqlalchemy 0.5.1 with python 2.5.4 on windows. and mysql 5.1. the task is simple: to keep fresh information about our servers. i can get a list of server names from AD, get some info about them and insert them into DB using Session.add(). if i run

[sqlalchemy] Losing columns on join ?

2009-01-21 Thread Stuart Axon
Hi, I've been using sqlalchemy with sqlsoup and having some trouble getting my head around joins in here as opposed to sql. I've two tables, device + manufacturer [device] id, device_name, manufacturer [manufacturer] id, manufacturer_name I can't seem to get a result that contains both

[sqlalchemy] Re: Losing columns on join ?

2009-01-21 Thread Michael Bayer
On Jan 21, 10:59 am, Stuart Axon stua...@yahoo.com wrote: Hi,   I've been using sqlalchemy with sqlsoup and having some trouble getting my head around joins in here as opposed to sql. I've two tables,  device + manufacturer [device] id, device_name, manufacturer [manufacturer] id,

[sqlalchemy] Re: passing tuple argument into sqlalchemy.sql.text string

2009-01-21 Thread Faheem Mitha
On Wed, 21 Jan 2009 10:55:14 -, King Simon-NFHD78 simon.k...@motorola.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Faheem Mitha Sent: 20 January 2009 22:05 To: sqlalchemy@googlegroups.com Subject:

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg
I guess I'm kind of confused as to how it's supposed to create a table that it doesn't even really know about yet. It hasn't successfully reflected the table yet, so shouldn't know anything about its structure. It seems like it'd just create an empty table at this point. engine =

[sqlalchemy] Re: passing tuple argument into sqlalchemy.sql.text string

2009-01-21 Thread Faheem Mitha
On Wed, 21 Jan 2009 08:26:13 -0800, jason kirtland j...@discorporate.us wrote: Faheem Mitha wrote: Hi, I've got a query as follows: from sqlalchemy.sql import text gq = text( SELECT decode_genotype(cell.snpval_id, snp.allelea_id, snp.alleleb_id) FROM cell JOIN snp ON snp.fid =

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg
As a disclaimer, this is a legacy system in which I have no control over, so what you are about to see is pretty disturbing :) http://pastebin.com/m10d49ac1 The formatting is pretty crazy, I'm hoping you can make use of this. --~--~-~--~~~---~--~~ You received

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Rick Morrison
Hey Greg, please set the output format to text (if you're in mssql 2005, there's a button over the query window with a tooltip that should say Results to text) and re-run the query. The text output will be a lot easier to read. Thanks --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Don Dwiggins
Greg wrote: As a disclaimer, this is a legacy system in which I have no control over, so what you are about to see is pretty disturbing :) http://pastebin.com/m10d49ac1 The formatting is pretty crazy, I'm hoping you can make use of this. If you have the MSSQL tools handy, try this: -

[sqlalchemy] Re: passing tuple argument into sqlalchemy.sql.text string

2009-01-21 Thread jason kirtland
Faheem Mitha wrote: On Wed, 21 Jan 2009 08:26:13 -0800, jason kirtland j...@discorporate.us wrote: Faheem Mitha wrote: Hi, I've got a query as follows: from sqlalchemy.sql import text gq = text( SELECT decode_genotype(cell.snpval_id, snp.allelea_id, snp.alleleb_id) FROM cell JOIN

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Rick Morrison
On Wed, Jan 21, 2009 at 12:16 PM, Michael Bayer mike...@zzzcomputing.comwrote: I think we might need to just change the *args approach in mssql reflecttable to do everything based on keyword arguments, and add in some isinstance(String) / isinstance(Numeric) to determine what args get sent

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg
Unfortunately, I'm connecting remotely via iODBC and do not have said tools. I'm running Ubuntu Linux, if you know of any way to get the same thing prettied up, let me know and I will. On Jan 21, 12:22 pm, Don Dwiggins d...@dondwiggins.net wrote: Greg wrote: As a disclaimer, this is a legacy

[sqlalchemy] Slow subqueries in one-to-many relation with Joined Table Inheritance

2009-01-21 Thread Tomasz Domanski
Hello all, I have a question about SQLAlchemy when dealing with joining on one-to- many relationships. When I try to load data with eager=True for relation with objects, which subclasses from some base class, SQLAlchemy generates query with subselect. Subselects are quite painful for me, as I'm

[sqlalchemy] pretend like an object was loaded, not created

2009-01-21 Thread qvx
I have a web application which is accessed from different sub-domains. Each sub-domain corresponds to one row/object in installation table. I am fetching this one row/object on every request which is unnecessary. My question is: how can I fetch this object only once and somehow stuff it inside a

[sqlalchemy] Re: pretend like an object was loaded, not created

2009-01-21 Thread Michael Bayer
the session.merge() method is provided with a flag dont_load=True to assist in common caching scenarios. it copies the state of a cached object into a given session so that you get the benefits of globally cached state combined with no data shared between sessions. some examples of

[sqlalchemy] concatentated column property with joins

2009-01-21 Thread MHC
Perhaps someone could offer some guidance here. I am trying to make a column_property. The value of this property is supposed to be the concatenation of two fields from different tables, both joined to the mapped table. To make an example I have renamed these tables parent, child, and

[sqlalchemy] checking if a column is in a list

2009-01-21 Thread Jack Stahl
Hello, I've got a few SQL interfaces where I'd like to change my query based on the columns required by the client. For example, in one situation, I only join against my User table if my client requires a photo id: # cols is the list of columns the client would like selected if User.c.photo_id

[sqlalchemy] Re: checking if a column is in a list

2009-01-21 Thread Michael Bayer
On Jan 21, 2009, at 7:46 PM, Jack Stahl wrote: Hello, I've got a few SQL interfaces where I'd like to change my query based on the columns required by the client. For example, in one situation, I only join against my User table if my client requires a photo id: # cols is the list

[sqlalchemy] Re: checking if a column is in a list

2009-01-21 Thread Jack Stahl
Thanks Michael! Properly was a poor choice of words on my part. Yes, of course, == is overloaded to make where (etc) clauses pretty, I just didn't put two and two together. --jack On Wed, Jan 21, 2009 at 5:38 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 21, 2009, at 7:46 PM, Jack

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Rick Morrison
I think we might need to just change the *args approach in mssql reflecttable to do everything based on keyword arguments Yeah, that sounds like a good approach. I'll have a look later today. Attached is an untested patch against trunk that uses only kwargs to build out the tabledef. I

[sqlalchemy] Re: concatentated column property with joins

2009-01-21 Thread Michael Bayer
On Jan 21, 2009, at 6:15 PM, MHC wrote: Perhaps someone could offer some guidance here. I am trying to make a column_property. The value of this property is supposed to be the concatenation of two fields from different tables, both joined to the mapped table. To make an example I have

[sqlalchemy] Re: pretend like an object was loaded, not created

2009-01-21 Thread qvx
This project moves so fast. I guess it's time to reread the documentation. Again. Knowing how great this project is, it was silly of me not to expect SQLAlchemy ho have such functionality built in into the public interface: I was kinda expecting to play with the object state or who knows what.

[sqlalchemy] Re: does tometadata have to change foreign key schema name if it already specified?

2009-01-21 Thread sector119
Thank you, Michael, it was very helpful! Michael Bayer написав: this can be changed but the function still makes no sense. What if you also said t3 = users.tometadata(metadata, schema='SOME_SCHEMA') ? then you would want the system.users.id FK to be changed.the tometadata() approach