Sign inSign up

eduard93/snowflake

By eduard93

•Updated about 2 years ago

Debugging Snowflake ODBC driver

Image
Databases & storage
0

298

eduard93/snowflake repository overview

Instructions.

  1. Start container: docker run -d --name odbc eduard93/snowflake
  2. Wait 2 mins for it to start or check the logs with: docker logs odbc The following line indicates that the app is fully started: [INFO] ...executed command /docker-entrypoint.sh iris-after-start
  3. Login inside the container: docker exec -it odbc bash
  4. Adjust DSN config: nano /usr/irissys/mgr/irisodbc.ini
  5. Reproduce the issue (note that this command cannot contain whitespaces between Test arguments): iris session iris '##class(Utils.ODBC).Test(,"usr","password")' You’ll see process id and after that the process hangs.
  6. (Optional) Execute a successful call: a. Interactively login into iris shell: iris session iris b. Run the same thing interactively: do ##class(Utils.ODBC).Test(,"usr","password")
  7. Shut the container down: docker stop odbc

First argument of the Utils.ODBC:Test method is the DSN name and I’m defaulting to Snowflake.

Dockerfile

# The base IRIS image. Modify the build script argument to use a different version.
ARG IMAGE=intersystemsdc/iris-community
FROM $IMAGE


# Get some dependencies with root power
USER root
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y \
  unixodbc nano

RUN wget https://sfc-repo.snowflakecomputing.com/odbc/linux/3.3.2/snowflake-odbc-3.3.2.x86_64.deb \
    && dpkg -i snowflake-odbc-3.3.2.x86_64.deb


RUN cp /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 /usr/lib/x86_64-linux-gnu/libodbcinst.so.1

# Install apache as the same non-root user who owns the IRIS instance
# and is the default user for this container, so that default user
# can start and stop Apache, modify config files, etc.
USER ${ISC_PACKAGE_MGRUSER}

WORKDIR /home/irisowner/irisbuild


RUN --mount=type=bind,src=.,dst=. \
    cp /home/irisowner/irisbuild/irisodbc.ini $ISC_PACKAGE_INSTALLDIR/mgr/irisodbc.ini && \
    iris start IRIS && \
    iris session IRIS < iris.script && \
    iris stop IRIS quietly

iris.script

do $system.OBJ.Load("/home/irisowner/irisbuild/ODBC.cls", "ck")
halt

ODBC.cls

Class Utils.ODBC
{

ClassMethod Test(dsn="Snowflake",usr,pwd)
{
    write "Process id: ",$j,!
    set gc=##class(%SQLGatewayConnection).%New()
    set sc=gc.Connect(dsn,usr,pwd,0) // This line calls C code and hangs
    write "SUCCESS", !
    set ^dbg($j, $i(^dbg($j))) = "Connect"

}

}

irisodbc.ini

[ODBC Data Sources]
Snowflake=Snowflake

[Snowflake]
Driver      = /usr/lib/snowflake/odbc/lib/libSnowflake.so
Description = TEST
server      = !!!.snowflakecomputing.com
database    = !!!
warehouse   = !!!

Tag summary

Content type

Image

Digest

sha256:778aded86…

Size

1.1 GB

Last updated

about 2 years ago

docker pull eduard93/snowflake