Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
700 stars 145 forks source link

After update to multicorn-1.3.2 and ubuntu14.04.4 I get TypeError: expected string or buffer #134

Closed arag0rn2k3 closed 8 years ago

arag0rn2k3 commented 8 years ago

The Problem is only to MSSQL-DB...how can i fix it?

File "/usr/local/lib/python2.7/dist-packages/multicorn-1.3.2-py2.7-linux-x86_64.egg/multicorn/sqlalchemyfdw.py", line 356, in begin self.transaction = self.connection.begin()

      File "/usr/local/lib/python2.7/dist-packages/multicorn-1.3.2-py2.7-linux-x86_64.egg/multicorn/sqlalchemyfdw.py", line 352, in connection
        self._connection = self.engine.connect()

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1641, in connect
        return self._connection_cls(self, **kwargs)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 59, in __init__
        self.__connection = connection or engine.raw_connection()

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1699, in raw_connection
        return self.pool.unique_connection()

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 220, in unique_connection
        return _ConnectionFairy(self).checkout()

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 431, in __init__
        rec = self._connection_record = pool._do_get()

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 772, in _do_get
        return self._create_connection()

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 225, in _create_connection
        return _ConnectionRecord(self)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 322, in __init__
        exec_once(self.connection, self)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/event.py", line 392, in exec_once
        self(*args, **kw)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/event.py", line 409, in __call__
        fn(*args, **kw)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 1049, in go
        return once_fn(*arg, **kw)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 168, in first_connect
        dialect.initialize(c)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/dialects/mssql/base.py", line 1129, in initialize
        super(MSDialect, self).initialize(connection)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 170, in initialize
        self._get_server_version_info(connection)

      File "/usr/lib/python2.7/dist-packages/sqlalchemy/dialects/mssql/pymssql.py", line 72, in _get_server_version_info
        r"Microsoft SQL Server.*? - (\d+).(\d+).(\d+).(\d+)", vers)

      File "/usr/lib/python2.7/re.py", line 137, in match
        return _compile(pattern, flags).match(string)

    TypeError: expected string or buffer
arag0rn2k3 commented 8 years ago

The problem is since an update of multicorn, ubuntu, sqlalchemy and all other packages and my update from Postgresql 9.3.5 to PostgreSQL 9.5.0 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit

The MSSQL Database is completely untouched (no changes or updates)

I get the error if I Select something in MSSQL over my Postgresql with Multicorn Extension TESTCASE:

create foreign table NAV_OPEN_VENDOR ( "vendor" varchar, "posting_date" date, "remamount" numeric ) server alchemy_srv options ( tablename 'open_vendor', db_url 'mssql+pymssql://user:pass@192.168.1.100/database' );

In PostgreSQL: SELECT * from NAV_OPEN_VENDOR; -> TypeError: expected string or buffer

arag0rn2k3 commented 8 years ago

it seem that not the correct version string is reported to the SQLAlchemy driver...