Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Ladislav Lenart
Hello. otherwise, I'd consider using pyodbc for which the dialect and DBAPI are production quality. I use pyodbc with FreeTDS on unix platforms in production. Ok, I can use pyodbc if it is the preferred choice. However I cannot make it work either. I suspect that I supply bad connection

[sqlalchemy] Handle Server Disruption

2012-10-08 Thread RedBaron
Hi, I am writing a standalone program that uses SQLAlchemy for DB related ops. The program is a log parser that runs continuously, processes the log file and writes those entries to the database. Connection to DB is done like so engine = create_engine('mysql+mysqldb://root:root123@localhost/

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Ladislav Lenart
Hello again. It turned out that I was missing some ODBC-related packages and also needed to configure freetds to work with unixodbc. I managed to finally do it, though it was by no means easy for me (trial and error of several tutorials). The following code works now: import pyodbc cnxn =

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Ladislav Lenart
Hello. UPDATE: The raw SqlSoup.execute() works: import pyodbc from sqlalchemy.engine import create_engine from sqlalchemy.ext.sqlsoup import SqlSoup def connect(): return

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Michael Bayer
no such table usually means you're not connected to the database that you think you are. I'd strongly suggest configuring an ODBC datasource within FreeTDS, and using standard connection techniques. Hostname, port, tds version go into freetds.conf, and database names go into odbc.ini. In

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Ladislav Lenart
Ok, I will give it yet another try, but please note that the following works: import pyodbc from sqlalchemy.engine import create_engine from sqlalchemy.ext.sqlsoup import SqlSoup def connect(): return

Re: [sqlalchemy] joined table inhertiance and eager loading self-referencing relationships

2012-10-08 Thread Michael Bayer
On Oct 7, 2012, at 6:56 PM, Michael Bayer wrote: On Oct 7, 2012, at 2:17 AM, me wrote: using python 2.7, sqla 0.7.9, postgresql 9.1 i've setup joined table inheritance and wanted an eager loaded relationship from one of the derived objects to another derived object. when i do that i

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Michael Bayer
On Oct 8, 2012, at 11:10 AM, Ladislav Lenart wrote: Ok, I will give it yet another try, but please note that the following works: import pyodbc from sqlalchemy.engine import create_engine from sqlalchemy.ext.sqlsoup import SqlSoup def connect(): return

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Ladislav Lenart
Hello. perhaps. Maybe the connection doesn't have correct access to the information schema tables, as SQLSoup relies upon table reflection. you'd need to run with echo='debug' on your engine to see exactly what queries are being emitted and the rows being returned, and determine why an

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Michael Bayer
your freetds datasource should be configured with CLIENT_CHARSET=utf8 as I illustrated earlier: [ms_2005] host = 172.16.248.128 port = 1213 tds version = 8.0 client charset = UTF8 text size = 5000 On Oct 8, 2012, at 11:43 AM, Ladislav Lenart wrote:

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Ladislav Lenart
Hello. I adjusted the ODBC/FreeTDS condifugration according to your suggestions but still get the NoSuchTableError: mlm_spol. freetds.conf: [zfp] host = 10.230.128.140 port = 1433 tds version = 8.0 asa database = ZFP_CRM client charset = utf8 text size = 5000 odbc.ini: [ODBC Data

[sqlalchemy] Problem with merging related objects with surrogate keys

2012-10-08 Thread Paul Harrington
I am helping a colleague with a SQL Alchemy problem that I have not encountered before. What we are trying to do seems reasonable enough: merge in a bunch of related objects. However, we run into difficulty when using physical data-models that have surrogate PKs. In this example Bar has a FK

Re: [sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-08 Thread Michael Bayer
if you didnt have this problem with pymssql then please apply the patch I sent previously. However, I'm going to bet the problem remains as it seems something is not right with how your database and/or client is configured. I'm not familiar with the encoding pattern seen in your