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

2012-10-14 Thread Michael Bayer
On Oct 13, 2012, at 12:20 AM, Yap Sok Ann wrote: On Tuesday, October 9, 2012 10:19:34 PM UTC+8, Michael Bayer wrote: yeah, the whole FreeTDS story is awful, I don't understand any of it either. I'm still at wave a dead chicken stage with FreeTDS

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

2012-10-12 Thread Yap Sok Ann
On Tuesday, October 9, 2012 10:19:34 PM UTC+8, Michael Bayer wrote: yeah, the whole FreeTDS story is awful, I don't understand any of it either. I'm still at wave a dead chicken stage with FreeTDS ( http://dictionary.reference.com/browse/wave+a+dead+chicken). The ODBC Driver 1.0 for

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

2012-10-09 Thread Ladislav Lenart
Hello. No, I was not able to connect via pymssql. Furthemore I would like to use pyodbc if it is the preferred way. I just did not know that when I started with pymssql. It really is a misconfigured character encoding issue in pyodbc / freetds on my part. I am just clueless as to what should I

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

2012-10-09 Thread Ladislav Lenart
Also, this works correctly: isql -v zfp efractal efR@cZFP13 +---+ | Connected!| | | | sql-statement | | help [tablename] | | quit

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

2012-10-09 Thread Michael Bayer
On Oct 9, 2012, at 6:03 AM, Ladislav Lenart wrote: Hello. No, I was not able to connect via pymssql. Furthemore I would like to use pyodbc if it is the preferred way. I just did not know that when I started with pymssql. It really is a misconfigured character encoding issue in pyodbc

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

2012-10-09 Thread Ladislav Lenart
Hello. I made some progress. I have client charset in my freetds config file. I am also certain that the config and the charset is used by pyodbc / freetds combo. Without it I get 'Ne?...'. With it I get back a str encoded in utf-8. I also enabled freetds logging where I clearly see two

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

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] [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

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

[sqlalchemy] [Q] SQLSoup and pymssql from Linux

2012-10-05 Thread Ladislav Lenart
Hello. I try to access a Microsoft SQL database from Linux (Debian testing): from sqlalchemy.ext.sqlsoup import SqlSoup conn_string = 'mssql+pymssql://user:pass@freetds_name' db = SqlSoup(conn_string) v = db.some_table.first() print v freetds_name is the section name from

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

2012-10-05 Thread lenartlad
Hello. I dont have easy access to pymssql here so can you fully define what fails means ? stack trace ? I don't have access to my development environment during the weekend, so I cannot provide you with a stacktrace, but I try to better describe the issue: def

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

2012-10-05 Thread Michael Bayer
what I can do for the moment is this patch, if you want to try it: diff -r 17cab4ad55d5 lib/sqlalchemy/dialects/mssql/pymssql.py --- a/lib/sqlalchemy/dialects/mssql/pymssql.py Thu Oct 04 18:26:55 2012 -0400 +++ b/lib/sqlalchemy/dialects/mssql/pymssql.py Fri Oct 05 18:46:01 2012 -0400 @@ -80,7