Ok, thanks to the guidance of the community I manage to got it to work... I believe its important for me to mention a few things you should take in account when attempting this (at least under the same environment I been trying).
My setup:
- Ubuntu 14.04 <-> PostgreSQL 9.3
- Windows Server 2003 <-> SQL Server 2005
Additional components:
- SQL Alchemy 0.9.9
- Multicorn 1.1.0
Im not gonna go into details on how to install this components since there's plenty of documentation online.
Once this is setup I took a_horse_with_no_name advice on changing SQL Server authentication to mixed authentication and created a new account, for the sake of the example I use postgres:postgres
. Additionaly still on SSMS I defined SELECT
permissions for user postgres
in the table I wanted to get the data from tblTest
.
Back in my PostgreSQL I created a new database (pgTest
) and setup multicorn:
CREATE EXTENSION multicorn;
Created the server for our FOREIGN DATA WRAPPER:
CREATE SERVER alchemy_srv FOREIGN DATA WRAPPER multicorn options (
wrapper 'multicorn.sqlalchemyfdw.SqlAlchemyFdw'
);
And then (what it was supposed to be the last step) create the table that is going to get data from MS SQL Server:
CREATE FOREIGN TABLE pgTable (LogTime varchar,
LogUser varchar,
LogData varchar)
server alchemy_srv OPTIONS (tablename 'tblTest',
db_url 'mssql+pymssql://postgres:postgres@10.0.0.0/RemoteDBName');
This shows no error, but once you throw a simple SELECT * FROM pgTable;
I was getting the error I OP up there.
So I search a bit more and stumbled on this Google Groups posts labeled on a response as a BUG.
One of the offered solutions is getting rid of pymssql, as in:
apt-get uninstall python-pymssql; pip install pymssql
After this I tried again to create the table and getting data but nothing happened, i was just getting a blank table.
So I pip install pymssql --upgrade
, once again create the table within PostgreSQL and voila! this time worked perfect.
Hopefully this will help someone else in the future, thanks for your guidance!
Best Answer
Yes. Someone who has administrative rights (aka admin rights) to the SQL instance can change this by using SQL Server Management Studio.