[sqlalchemy] Re: MySQL has gone away (again)

2009-06-08 Thread Kamil Gorlo
On Thu, Jun 4, 2009 at 4:20 PM, Michael Bayermike...@zzzcomputing.com wrote: the connection went from good to dead within a few seconds (assuming SQL was successfully emitted on the previous checkout).   Your database was restarted or a network failure occurred. There is no other option? I'm

[sqlalchemy] Re: SQLAlchemy for c++

2009-06-08 Thread Can Xue
2009/6/8 Jarrod Chesney jarrod.ches...@gmail.com Hi All Does anyone knows where i can find information about using SQLAlchemy from c++ or even if its possible. SQLAlchemy is written in pure python. So, you question should be: * How to embed the Python interpreter in my C++ program? or *

[sqlalchemy] insert statment

2009-06-08 Thread Ash
Hello , I am trying to insert in the table using two ways in the values which i show below engine = sqlalchemy.create_engine(to poastgres) metadata = MetaData() t1 = Table('master',metadata) # assume master has 2 feilds name , city t1.insert({'name':'','city':'bank'}) engine,execute(t1)

[sqlalchemy] Formatting return of 'query'

2009-06-08 Thread Harish Vishwanath
Hello, Can a query be written to return required columns along with some delimiter? Example : #User is a class, it has firstname, lastname, age, password q = session.query(User.firstname,User.lastname,User.age,User.password).all() #this would return [(fname,lname,22,pwd),] How can I

[sqlalchemy] Engine.execute interpreting all parameters as string data

2009-06-08 Thread Malherbe
I'm new to SQLAlchemy (and Python in general) and have been struggling to get a basic execution wrapper working - the goal is to use of raw batches of parameterized SQL - no ORM. The engine initializes and I can run queries through it without a problem, however the generated SQL from the execute

[sqlalchemy] Re: Formatting return of 'query'

2009-06-08 Thread Glauco
Harish Vishwanath ha scritto: cut How can I modify this query to return something like : [(fname~lname~22~pwd)...] with '~' being preferred delimiter. SA return a list or record, what exactly you are searching for? a string or something else I would like to know if I can return

[sqlalchemy] Re: Engine.execute interpreting all parameters as string data

2009-06-08 Thread Michael Bayer
Malherbe wrote: I'm new to SQLAlchemy (and Python in general) and have been struggling to get a basic execution wrapper working - the goal is to use of raw batches of parameterized SQL - no ORM. The engine initializes and I can run queries through it without a problem, however the

[sqlalchemy] Re: MySQL has gone away (again)

2009-06-08 Thread Michael Bayer
Kamil Gorlo wrote: On Thu, Jun 4, 2009 at 4:20 PM, Michael Bayermike...@zzzcomputing.com wrote: the connection went from good to dead within a few seconds (assuming SQL was successfully emitted on the previous checkout).   Your database was restarted or a network failure occurred. There

[sqlalchemy] Re: MySQL has gone away (again)

2009-06-08 Thread jason kirtland
Kamil Gorlo wrote: On Thu, Jun 4, 2009 at 4:20 PM, Michael Bayermike...@zzzcomputing.com wrote: the connection went from good to dead within a few seconds (assuming SQL was successfully emitted on the previous checkout). Your database was restarted or a network failure occurred. There is

[sqlalchemy] Re: Engine.execute interpreting all parameters as string data

2009-06-08 Thread phrrn...@googlemail.com
I was about to follow up to Mike's suggestion of a CAST with That will never work because ... but I decided to try it out and .. it works!!!: for i in e.execute(sql.text(select result = dateadd(day, CONVERT (INTEGER,:days), getdate())), dict(days = 7)): print i (datetime.datetime(2009, 6,

[sqlalchemy] Re: SQLAlchemy for c++

2009-06-08 Thread Didip Kerabat
If you are looking for ORM in c++, maybe this conversation can help: http://stackoverflow.com/questions/74141/good-orm-for-c-solutions - Didip - On Sun, Jun 7, 2009 at 11:56 PM, Jarrod Chesney jarrod.ches...@gmail.comwrote: Hi All Does anyone knows where i can find information about using

[sqlalchemy] Re: insert statment

2009-06-08 Thread Didip Kerabat
You have Syntax Error here: ('sdsd':'sdsds') That one should be tuple right? - Didip - On Mon, Jun 8, 2009 at 6:14 AM, Ash ashishsinghbha...@gmail.com wrote: Hello , I am trying to insert in the table using two ways in the values which i show below engine = sqlalchemy.create_engine(to

[sqlalchemy] Testing and version 0.5.4

2009-06-08 Thread Tomas Zulberti
Hi. I am wanting to do some testing of an application that uses SQLAlchemy 0.5.4, but I need to load some initial data to the database. When I searched for this in google, python-fixture appears as the answer. But checking the page of python-fixture it doesn't seems work for 0.5. The question

[sqlalchemy] Re: Engine.execute interpreting all parameters as string data

2009-06-08 Thread Malherbe
Thanks for the reply - A cast works fine here, but it is a workaround that would be nice to avoid. I'll see what kind of behavior I get by dropping back to just pyodbc. My other concern is that all numeric parameters are being treated as varchar and undergoing implicit conversions in SQL Server

[sqlalchemy] Re: Formatting return of 'query'

2009-06-08 Thread phrrn...@googlemail.com
I have something like this to serialize a result-set to delimited file- format. It is not very pretty and probably not at all pythonic but I find it handy. pjjH def as_delimited(q, *args): csvdata = StringIO() w = writer(csvdata, delimiter='|') for i in q.values(*args):

[sqlalchemy] Re: 0.5.3 ORM, MSSQL and FreeTDS: Invalid Cursor State exception?

2009-06-08 Thread ddorothy
I have looked into this and considered what you have said. I think I have come up with a potential solution. It seems to be that the most common driver for mssql on non-windows platforms is going to be freeTDS. Since there appears to be no way of knowing what ODBC is using under the hood we

[sqlalchemy] Re: 0.5.3 ORM, MSSQL and FreeTDS: Invalid Cursor State exception?

2009-06-08 Thread Michael Bayer
I'd rather a flag, or better yet in 0.6 a freetds specific dialect/url, i.e. mssql+freetds://url. ddorothy wrote: I have looked into this and considered what you have said. I think I have come up with a potential solution. It seems to be that the most common driver for mssql on

[sqlalchemy] Re: 0.5.3 ORM, MSSQL and FreeTDS: Invalid Cursor State exception?

2009-06-08 Thread Michael Trier
On Mon, Jun 8, 2009 at 5:29 PM, Michael Bayer mike...@zzzcomputing.comwrote: I'd rather a flag, or better yet in 0.6 a freetds specific dialect/url, i.e. mssql+freetds://url. I personally like the freetds dialect idea because there's a lot more issues specific to freetds than just this one.

[sqlalchemy] unit tests migrating to nose

2009-06-08 Thread Michael Bayer
hey gang - We've ported the unit tests over to nose, and our work is currently in a dev branch in SVN which you can see at http://svn.sqlalchemy.org/sqlalchemy/branches/nosetests . This port is against the 0.5 trunk, and the plan is to merge it to both 0.5 trunk and to 0.6 where we would

[sqlalchemy] Re: Engine.execute interpreting all parameters as string data

2009-06-08 Thread Malherbe
A little testing confirms that the problem is bubbling up from below SA. The equivalent statement run through pyodbc yields the same error. Out of curiosity, I checked to see if Python types were converted as expected in a different context. for pytype in (1, 1.1, decimal.Decimal('1.1'), '1',

[sqlalchemy] Re: insert statment

2009-06-08 Thread Ashish Bhatia
Sorry, Its my typing mistake :( . I put : insted , . But still my question yeat remained unanswered. :( On Jun 8, 7:50 pm, Didip Kerabat did...@gmail.com wrote: You have Syntax Error here: ('sdsd':'sdsds') That one should be tuple right? - Didip - On Mon, Jun 8, 2009 at 6:14 AM, Ash

[sqlalchemy] Re: insert statment

2009-06-08 Thread Michael Bayer
you need to use the executemany form described at http://www.sqlalchemy.org/docs/05/sqlexpression.html#executing-multiple-statements . On Jun 8, 2009, at 11:54 PM, Ashish Bhatia wrote: Sorry, Its my typing mistake :( . I put : insted , . But still my question yeat remained unanswered.