Segfault-Inc / Multicorn

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

Changed import to fix error while creating server in postgres #174

Closed soring closed 6 years ago

soring commented 7 years ago

Fixes issue with imports in sqlalchemy.fdw where

- Executing query:
create extension multicorn;

Query returned successfully with no result in 249 msec.

-- Executing query:
CREATE SERVER alchemy_srv
FOREIGN DATA WRAPPER multicorn
OPTIONS (wrapper 'multicorn.sqlalchemyfdw.SqlAlchemyFdw');
ERROR:  Error in python: ImportError
DETAIL:  cannot import name ARRAY

********** Error **********

ERROR: Error in python: ImportError
SQL state: XX000
Detail: cannot import name ARRAY

This error lead me to the following ticket on your issue tracker https://github.com/Kozea/Multicorn/issues/159

Changin the import from

from sqlalchemy.dialects.postgresql.base import (
    ARRAY, ischema_names, PGDialect, NUMERIC)

------- to

from sqlalchemy.dialects.postgresql.base import ( ischema_names, PGDialect, NUMERIC)
from sqlalchemy.dialects.postgresql.array import ARRAY
df7cb commented 7 years ago

655e4fb fixes the problem for newer sqlalchemy versions, but on older versions it throws

21:43:51 ! ERROR:  Error in python: ImportError
21:43:51 ! DETAIL:  No module named array
21:43:51 ! CONTEXT:  SQL statement " 
21:43:51 !     CREATE server multicorn_srv foreign data wrapper multicorn options (
21:43:51 !         wrapper 'multicorn.sqlalchemyfdw.SqlAlchemyFdw',
21:43:51 !         db_url 'postgresql://postgres@localhost/regression'
21:43:51 !     );
21:43:51 !     "
21:43:51 ! PL/pgSQL function create_foreign_server() line 6 at EXECUTE statement
hugff commented 7 years ago

I have install 1.3.3 version over Postgresql 9.6 throught pgxnclient and this error it's present.

When will be available a new version with this correction to be installed trought pgxnclient ?

Thanks

rdunklau commented 6 years ago

I just commited a fix for that, thanks !