-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ODBC connection from SAS #38
Comments
Hello! I'm trying to do the same, at this very moment :) I have a bit more success, I managed to connect DuckDB to SAS, but only when running the SAS workspace (directly on Linux) with: /sas/SASHome/SASFoundation/9.4/sas -nodms -encoding wlatin2 And I would need it in UTF-8. What is your session encoding? What does proc options option=encoding; run; says for you? More info about the setup that works for me:
The LIBNAME in SAS: libname kk odbc noprompt="dsn=DuckDB;Database=/tmp/duck2.db;access_mode=read_only" autocommit=yes; Then SQL: proc sql;
select * from kk.foo;
quit; But it works ONLY if |
Hi @gravesti , have you had any success with the above? Can you post the output of |
Thanks for the nudge. I have finally had success now using the current stable driver (https://github.com/duckdb/duckdb/releases/download/v1.1.0/duckdb_odbc-linux-amd64.zip). |
That's great news! Thanks for the feedback. Now I just somehow must get it to work with UTF-8, because in my language, accents are not optional... :) |
Is writing tables to the duckDB lib in SAS working for you? Currently I can get the error below. I've tried setting
|
Hello @gravesti you're right, I'm getting the same error. This does NOT work: libname kk odbc noprompt="Driver=DuckDB Driver;Database=/tmp/duck2.db" autocommit=yes;
proc sql;
insert into kk.foo values (45);
quit;
proc sql;
select * from kk.foo;
quit; The output is below -- it is a very stange way to fail, because the connection CLEARLY works, since the SELECT statement runs:
But some good news: it apparently works if we use the other, more convoluted way of SAS ODBC connection. This proc sql;
connect to odbc as kk (required="Driver={DuckDB Driver};Database=/tmp/duck2.db");
select * from connection to kk (
insert into foo values (45)
);
disconnect from kk;
quit; It did insert the "45":
The one good news is that since this is the "SQL-pass-through" type of ODBC calling in SAS, at least SAS won't try to interpret the SQL -- which means we can use DuckDB's friendly dialect to write the SQL, which would not be possible with Hope this helps somehow! :) Edit: added clarification re: SQL pass-through |
Thanks @kksaohun for the tip. So what you wrote does work for me. Creating tables also seems to work like this:
(Occasionally i get What I can't do yet is write a table from a SAS library to the duckdb connection. In passthrough I seem to only be able to use the tables from that connection. So I can't do |
@gravesti, have you tried using the |
I'm trying to use DuckDB via ODBC in SAS 9.4.
I get this incomprehensible message. Any ideas?
Nothing in my system is in Chinese.
The full odbctrace is here: https://gist.github.com/gravesti/b7fba9755712ce223b7e2284aedc0453
The text was updated successfully, but these errors were encountered: