sqitchers / docker-sqitch

Docker Image packaging for Sqitch
MIT License
35 stars 39 forks source link

Snowflake docker file does not work, wrong ODBC connector gets installed #12

Closed nabi-rd closed 3 years ago

nabi-rd commented 5 years ago

When trying to build the snowflake docker file, I keep getting this error about not having the right version of libdbdb-odbc-perl. It is expecting version 1.59 but version 1.56 gets installed. Tried installing higher version from a different repo, https://www.debian.org/distrib/packages unstable branch, (version 1.60) but apparently version is hard coded and does not work with newer libraries. Besides I checked the Debian repo, it does not contain version 1.59 (neither on stable nor unstable branches).

Any thoughts?

theory commented 5 years ago

Uh…that's odd. How are you attempting to build it? What command? Make sure it's using the latest Sqitch docker image for its base. That image contains a DBD::ODBC built from source, not the apt package.

nabi-rd commented 5 years ago

I used the Dockerfile you have in the snowflake directory which as I can see uses FROM sqitch/sqitch:latest. The command I use for building is env DIR=snowflake ./build --build-arg sf_account=$ACCOUNT ran in the root of the repo. So are you running the same and it is working for you?

theory commented 5 years ago

Yes. We run it like this:

env DIR=snowflake REGISTRY=$registry ./build --build-arg sf_account=$CCOUNT

The last build on June 4 looked like this:

Step 1/30 : FROM debian:stable-slim AS snow-build
stable-slim: Pulling from library/debian
Digest: sha256:a02ca7e73e03d13a57e47ad6bd5cf77a15384f46637cdf1d3a6fda48619a46a0
Status: Image is up to date for debian:stable-slim
 ---> 87f6f3b892c0
Step 2/30 : WORKDIR /work
 ---> Using cache
 ---> d48148da3bd3
Step 3/30 : ADD https://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/linux_x86_64/snowsql-1.1.79-linux_x86_64.bash snowsql.bash

 ---> Using cache
 ---> 4431c0a73a9d
Step 4/30 : ADD https://sfc-repo.snowflakecomputing.com/odbc/linux/2.13.19/snowflake_linux_x8664_odbc-2.13.19.tgz snowflake_linux_x8664_odbc.tgz

 ---> Using cache
 ---> ecaf5743f8e5
Step 5/30 : COPY conf ./
 ---> Using cache
 ---> 4a73574a8b2f
Step 6/30 : ENV WORKSPACE /var/snowsql
 ---> Using cache
 ---> fe919c0c4035
Step 7/30 : ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
 ---> Using cache
 ---> cbd26f410adc
Step 8/30 : ARG sf_account
 ---> Using cache
 ---> ecbe162a9fa9
Step 9/30 : RUN apt-get -qq update     && apt-get -qq --no-install-recommends install odbcinst     && gunzip -f *.tgz && tar xf *.tar      && mkdir odbc     && mv snowflake_odbc/lib snowflake_odbc/ErrorMessages odbc/     && mv simba.snowflake.ini odbc/lib/     && perl -i -pe "s/SF_ACCOUNT/$sf_account/g" odbc.ini     && cat odbc.ini >> /etc/odbc.ini     && cat odbcinst.ini >> /etc/odbcinst.ini     && sed -e '1,/^exit$/d' snowsql.bash | tar zxf -     && ./snowsql -Uv     && echo "[connections]\naccountname = $sf_account\n\n[options]\nnoup = true" > /var/snowsql/.snowsql/config
 ---> Using cache
 ---> f6106923bca3
Step 10/30 : FROM sqitch/sqitch:latest
latest: Pulling from sqitch/sqitch
11f34d1ed4d8: Already exists
5b9571053cad: Pulling fs layer
06a8d2402075: Pulling fs layer
f885b55c60eb: Pulling fs layer
6b9b2d46c8da: Pulling fs layer
6b9b2d46c8da: Waiting
f885b55c60eb: Verifying Checksum
f885b55c60eb: Download complete
06a8d2402075: Verifying Checksum
06a8d2402075: Download complete
6b9b2d46c8da: Verifying Checksum
6b9b2d46c8da: Download complete
5b9571053cad: Verifying Checksum
5b9571053cad: Download complete
5b9571053cad: Pull complete
06a8d2402075: Pull complete
f885b55c60eb: Pull complete
6b9b2d46c8da: Pull complete
Digest: sha256:0752300758af17093cd379f1ad140c364188b68dd9966f4dc7e580c851292856
Status: Downloaded newer image for sqitch/sqitch:latest
 ---> 92825ad811ec
Step 11/30 : USER root
 ---> Running in 68d5ba5eced5
Removing intermediate container 68d5ba5eced5
 ---> 9fa35af1a012
Step 12/30 : RUN apt-get -qq update     && apt-get -qq --no-install-recommends install unixodbc     && apt-get clean     && rm -rf /var/cache/apt/* /var/lib/apt/lists/*     && rm -rf /man /usr/share/man /usr/share/doc     && mkdir -p /usr/lib/snowflake/odbc/log     && printf '#!/bin/sh\n/var/snowsql --config /home/.snowsql/config "$@"\n' > /bin/snowsql     && chmod +x /bin/snowsql
 ---> Running in 48d4ec15c992
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libltdl7:amd64.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 10057 files and directories currently installed.)
Preparing to unpack .../libltdl7_2.4.6-2_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-2) ...
Selecting previously unselected package libodbc1:amd64.
Preparing to unpack .../libodbc1_2.3.4-1_amd64.deb ...
Unpacking libodbc1:amd64 (2.3.4-1) ...
Selecting previously unselected package odbcinst1debian2:amd64.
Preparing to unpack .../odbcinst1debian2_2.3.4-1_amd64.deb ...
Unpacking odbcinst1debian2:amd64 (2.3.4-1) ...
Selecting previously unselected package odbcinst.
Preparing to unpack .../odbcinst_2.3.4-1_amd64.deb ...
Unpacking odbcinst (2.3.4-1) ...
Selecting previously unselected package unixodbc.
Preparing to unpack .../unixodbc_2.3.4-1_amd64.deb ...
Unpacking unixodbc (2.3.4-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up libltdl7:amd64 (2.4.6-2) ...
Setting up libodbc1:amd64 (2.3.4-1) ...
Setting up odbcinst1debian2:amd64 (2.3.4-1) ...
Setting up odbcinst (2.3.4-1) ...
Setting up unixodbc (2.3.4-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Removing intermediate container 48d4ec15c992
 ---> c91090b6015e
Step 13/30 : COPY --from=snow-build /work/snowsql /var/
 ---> 1635308802da
Step 14/30 : COPY --from=snow-build --chown=sqitch:sqitch /var/snowsql /var/
 ---> 6fbe57721f00
Step 15/30 : COPY --from=snow-build /work/odbc /usr/lib/snowflake/odbc/
 ---> 86ba238812d6
Step 16/30 : COPY --from=snow-build /etc/odbc* /etc/
 ---> 3500b169ab92
Step 17/30 : USER sqitch
 ---> Running in 79d3f481ec87
Removing intermediate container 79d3f481ec87
 ---> dc4c90f10425
Step 18/30 : ENV WORKSPACE /var
 ---> Running in 9c0f6fbb4a8d
Removing intermediate container 9c0f6fbb4a8d
 ---> a7007c54a675
Step 19/30 : LABEL org.opencontainers.image.authors=Sqitch Hackers <sqitch-hackers@googlegroups.com>
 ---> Running in 10ba90bc885a
Removing intermediate container 10ba90bc885a
 ---> b9e27422fa7c
Step 20/30 : LABEL org.opencontainers.image.created=2019-06-04T14:54:32Z
 ---> Running in 8d2547fc31f2
Removing intermediate container 8d2547fc31f2
 ---> 410fa24b6c27
Step 21/30 : LABEL org.opencontainers.image.description=Sane database change management
 ---> Running in a7993eabca0e
Removing intermediate container a7993eabca0e
 ---> 7907c8326044
Step 22/30 : LABEL org.opencontainers.image.documentation=https://github.com/sqitchers/docker-sqitch#readme
 ---> Running in b830188c500f
Removing intermediate container b830188c500f
 ---> e61b5909e6e8
Step 23/30 : LABEL org.opencontainers.image.licenses=MIT
 ---> Running in 48cfbf160e39
Removing intermediate container 48cfbf160e39
 ---> 94605b8bf8f6
Step 24/30 : LABEL org.opencontainers.image.ref.name=sqitch-snowflake-1.0.0
 ---> Running in e8ba42858b4c
Removing intermediate container e8ba42858b4c
 ---> b5d122d2654e
Step 25/30 : LABEL org.opencontainers.image.revision=HEAD
 ---> Running in 11d018fb3b71
Removing intermediate container 11d018fb3b71
 ---> c24ee81557e4
Step 26/30 : LABEL org.opencontainers.image.source=https://github.com/sqitchers/docker-sqitch
 ---> Running in 036b98790a9e
Removing intermediate container 036b98790a9e
 ---> ba48a4819e2f
Step 27/30 : LABEL org.opencontainers.image.title=Sqitch
 ---> Running in f010e87e32b4
Removing intermediate container f010e87e32b4
 ---> f89ccc962bd5
Step 28/30 : LABEL org.opencontainers.image.url=https://hub.docker.com/r/sqitch/sqitch/
 ---> Running in ebcae42925ab
Removing intermediate container ebcae42925ab
 ---> f914c8a727ee
Step 29/30 : LABEL org.opencontainers.image.vendor=The Sqitch Community
 ---> Running in eaa6fde4568b
Removing intermediate container eaa6fde4568b
 ---> 96b6137c5d3a
Step 30/30 : LABEL org.opencontainers.image.version=1.0.0
 ---> Running in f7045cf4d93e
Removing intermediate container f7045cf4d93e
 ---> 8f4c762f5597
[Warning] One or more build-args [VERSION] were not consumed
Successfully built 8f4c762f5597

No attempt to install libdbdb-odbc-perl.

nabi-rd commented 5 years ago

Have you tried connecting to Snowflake using the docker container you built?

dnwarnock commented 5 years ago

I tried connecting to Snowflake using the instructions above and when I attempt to run any commands with docker-sqitch I'm hit with the following:

sqitch/sqitch:snowflake
Cannot determine Snowflake account name

Just to be clear I built my local image with env DIR=snowflake ./build --build-arg sf_account=myAccountName and I made sure that docker-sqitch was referencing my local image. Any ideas as to what going wrong? This is a great setup! I love to get it working..

theory commented 5 years ago
sqitch/sqitch:snowflake
Cannot determine Snowflake account name

What's your URL? Be sure to include the account name in the URI, e.g.,

db:snowflake://myAccountName@dwarnock/mydbname?Driver=Snowflake;warehouse=dwarnock

Although the account name gets embedded in the ODBC config, I'm not sure it actually gets read, so be sure to include it in your URLs or in the SNOWSQL_ACCOUNT environment variable.

dnwarnock commented 5 years ago

It sounds like I need to run the container with all the config pass in through the command line like env SNOWSQL_ACCOUNT=myaccountname SNOWSQL_USER=myuser SNOWSQL_DATABASE=mydb SNOWSQL_PWD=mypassword ./docker-sqitch status. I'd assume the container built specifically for snowflake would know which driver to use, but even with proper config the driver doesn't seem to be recognized:

[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)

What am I missing here? Thanks for the help

theory commented 5 years ago

Yes, and you can use all of those variables in URIs, as well:

sqitch status db:snowflake://myuser:mypassword@myaccountname/mydb

Although I don’t recommend using passwords this way. Instead, put them in your ~/.snowsql/config file at the top-level, and when you run the docker-sqitch.sh script, it will mount ~/ as the home directory so that the config can be read inside the container. Works for many other configs, too. See sqitch-authentication for details.

@nabi-rd: I’m going to verify that our internal docker image works today. Sorry for the delay.

theory commented 5 years ago

@nabi-rd: Did you set the SQITCH_IMAGE environment variable to your new Snowflake Sqitch image name? Should be something like

curl -L https://git.io/fAX6Z -o sqitch && chmod +x sqitch
SQITCH_IMAGE=sqitch/sqitch-snowflake //myuser:mypassword@myaccountname/mydb

This is because the default value for SQITCH_IMAGE in the docker-sqitch.sh script is sqitch/sqitch, which is the base image on Docker Hub without ODBC support.

theory commented 5 years ago

BTW, we have now confirmed that Sqitch v1.0.0 connects to Snowflake fine, although sqitch status shows "no changed deployed" on v1.0.0, but does show them in v0.9999. Which is worrying. I'm going to dig into that…

theory commented 5 years ago

Okay, yes, we've confirmed that the ODBC stuff works with our copy, @nabi-rd. I suspect you just need to set the SQITCH_IMAGE. Variable. But first, you should pull the changes to the repo here and run the build again, because the issue I mentioned above to @dnwarnock was due too a bug in the Snowflake ODBC driver, which went away when I upgraded it in e2bc7e6 and built a new image. Give that a try!

nabi-rd commented 5 years ago

I pulled all the recent changes of the repo, built the docker image and also set SQITCH_IMAGE to point to the built image, now I am getting the same error as @dnwarnock: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)

theory commented 5 years ago

Are you sure that's the name your image has? What does docker images show?

nabi-rd commented 5 years ago

Here is the result of my docker images:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
sqitch/sqitch       1.0.0-snowflake     c3c2a3785271        17 hours ago        396MB
sqitch/sqitch       snowflake           c3c2a3785271        17 hours ago        396MB

So I have set the SQITCH_IMAGE as below:

export SQITCH_IMAGE=sqitch/sqitch:snowflake

I have also echoed this env variable in docker-sqitch.sh by modifying the file as below:

...
SQITCH_IMAGE=${SQITCH_IMAGE:=sqitch/sqitch:latest}
echo $SQITCH_IMAGE
...

And sqitch/sqitch:snowflake is echoed, so seems to be picked up correctly.

theory commented 5 years ago

And what's the URI you're using? And what, if anything, is in your config?

nabi-rd commented 5 years ago

What I run is sh docker-sqitch.sh status db:snowflake://myuser:mypassword@myaccountname/mydb I also have the following in my Snowsql config at ~/.snowsql/config but I am not sure if it is being picked up at all:

[connections.example]
#Can be used in SnowSql as #connect example

accountname = ***
username = ***
password = ***
nabi-rd commented 5 years ago

Hey @theory, any updates?

theory commented 5 years ago

Sorry, moving this week. At this point all I can do is suggest you as a sage into the container and look around at the files. Compare them to what the darker file bills and make sure everything is where it supposed to be. I might have more time to look into it myself next week.

nabi-rd commented 5 years ago

Thanks @theory, good luck with your moving, I might do some investigations later.

theory commented 5 years ago

Hi @nabi-rd. Can you send me the complete output from Docker as it creates the image, please?

nabi-rd commented 5 years ago

Hi @theory, here is the build log for env DIR=snowflake REGISTRY=$registry ./build --build-arg sf_account=***:

Sending build context to Docker daemon  9.216kB
Step 1/30 : FROM debian:stable-slim AS snow-build
stable-slim: Pulling from library/debian
Digest: sha256:d846d80f98c8aca7d3db0fadd14a0a4c51a2ce1eb2e9e14a550b3bd0c45ba941
Status: Image is up to date for debian:stable-slim
 ---> 7279351ce73b
Step 2/30 : WORKDIR /work
 ---> Using cache
 ---> 9638c3513b53
Step 3/30 : ADD https://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/linux_x86_64/snowsql-1.1.81-linux_x86_64.bash snowsql.bash
Downloading [==================================================>]  12.18MB/12.18MB
 ---> Using cache
 ---> 953c219463a9
Step 4/30 : ADD https://sfc-repo.snowflakecomputing.com/odbc/linux/2.19.5/snowflake_linux_x8664_odbc-2.19.5.tgz snowflake_linux_x8664_odbc.tgz
Downloading [==================================================>]  40.91MB/40.91MB

 ---> Using cache
 ---> cd4367fcc35c
Step 5/30 : COPY conf ./
 ---> Using cache
 ---> 9cfbc2c58efb
Step 6/30 : ENV WORKSPACE /var/snowsql
 ---> Using cache
 ---> 30bd426afc89
Step 7/30 : ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
 ---> Using cache
 ---> e92f411a8ea2
Step 8/30 : ARG sf_account
 ---> Using cache
 ---> eb451db55df6
Step 9/30 : RUN apt-get -qq update     && apt-get -qq --no-install-recommends install odbcinst     && gunzip -f *.tgz && tar xf *.tar      && mkdir odbc     && mv snowflake_odbc/lib snowflake_odbc/ErrorMessages odbc/     && mv simba.snowflake.ini odbc/lib/     && perl -i -pe "s/SF_ACCOUNT/$sf_account/g" odbc.ini     && cat odbc.ini >> /etc/odbc.ini     && cat odbcinst.ini >> /etc/odbcinst.ini     && sed -e '1,/^exit$/d' snowsql.bash | tar zxf -     && ./snowsql -Uv     && echo "[connections]\naccountname = $sf_account\n\n[options]\nnoup = true" > /var/snowsql/.snowsql/config
 ---> Using cache
 ---> 028064642285
Step 10/30 : FROM sqitch/sqitch:latest
latest: Pulling from sqitch/sqitch
Digest: sha256:c4073f862d3fddd95fbe64fe06423bd1b2d02be0485234a1c880e3fd44800bec
Status: Image is up to date for sqitch/sqitch:latest
 ---> 1be15fbbe16f
Step 11/30 : USER root
 ---> Using cache
 ---> cef6891e6ac0
Step 12/30 : RUN apt-get -qq update     && apt-get -qq --no-install-recommends install unixodbc     && apt-get clean     && rm -rf /var/cache/apt/* /var/lib/apt/lists/*     && rm -rf /man /usr/share/man /usr/share/doc     && mkdir -p /usr/lib/snowflake/odbc/log     && printf '#!/bin/sh\n/var/snowsql --config /home/.snowsql/config "$@"\n' > /bin/snowsql     && chmod +x /bin/snowsql
 ---> Using cache
 ---> eaff61dfecfc
Step 13/30 : COPY --from=snow-build /work/snowsql /var/
 ---> Using cache
 ---> b36644b126b3
Step 14/30 : COPY --from=snow-build --chown=sqitch:sqitch /var/snowsql /var/
 ---> Using cache
 ---> fe85c8482c51
Step 15/30 : COPY --from=snow-build /work/odbc /usr/lib/snowflake/odbc/
 ---> Using cache
 ---> 169f8361d875
Step 16/30 : COPY --from=snow-build /etc/odbc* /etc/
 ---> Using cache
 ---> 8ac7dd5f36c0
Step 17/30 : USER sqitch
 ---> Using cache
 ---> 13cd3f14345c
Step 18/30 : ENV WORKSPACE /var
 ---> Using cache
 ---> d4cbba32367e
Step 19/30 : LABEL org.opencontainers.image.authors=Sqitch Hackers <sqitch-hackers@googlegroups.com>
 ---> Using cache
 ---> 74efc56ece5d
Step 20/30 : LABEL org.opencontainers.image.created=2019-07-04T04:46:43Z
 ---> Running in 86b4a2db7c22
Removing intermediate container 86b4a2db7c22
 ---> 8f3d556dca38
Step 21/30 : LABEL org.opencontainers.image.description=Sane database change management
 ---> Running in 9167ac719289
Removing intermediate container 9167ac719289
 ---> d7e699036d37
Step 22/30 : LABEL org.opencontainers.image.documentation=https://github.com/sqitchers/docker-sqitch#readme
 ---> Running in 35e849043741
Removing intermediate container 35e849043741
 ---> 42c5bbae7bb5
Step 23/30 : LABEL org.opencontainers.image.licenses=MIT
 ---> Running in 65a4104854a4
Removing intermediate container 65a4104854a4
 ---> d7847deec61b
Step 24/30 : LABEL org.opencontainers.image.ref.name=sqitch-snowflake-1.0.0
 ---> Running in 1e08c216762e
Removing intermediate container 1e08c216762e
 ---> ce312fb8601f
Step 25/30 : LABEL org.opencontainers.image.revision=master
 ---> Running in d9711a97fd34
Removing intermediate container d9711a97fd34
 ---> f702cbaf37df
Step 26/30 : LABEL org.opencontainers.image.source=https://github.com/sqitchers/docker-sqitch
 ---> Running in 6bdfb6b3faf7
Removing intermediate container 6bdfb6b3faf7
 ---> 50696eab5cb6
Step 27/30 : LABEL org.opencontainers.image.title=Sqitch
 ---> Running in c1d186889a24
Removing intermediate container c1d186889a24
 ---> df443f96708d
Step 28/30 : LABEL org.opencontainers.image.url=https://hub.docker.com/r/sqitch/sqitch/
 ---> Running in 0591aeaf2637
Removing intermediate container 0591aeaf2637
 ---> 77b5a1c3f086
Step 29/30 : LABEL org.opencontainers.image.vendor=The Sqitch Community
 ---> Running in a0e9b53b229d
Removing intermediate container a0e9b53b229d
 ---> 12d9309412f8
Step 30/30 : LABEL org.opencontainers.image.version=1.0.0
 ---> Running in 673a41e1e1d4
Removing intermediate container 673a41e1e1d4
 ---> af99be44043b
[Warning] One or more build-args [VERSION] were not consumed
Successfully built af99be44043b
Successfully tagged sqitch/sqitch:snowflake
Successfully tagged sqitch/sqitch:1.0.0-snowflake
theory commented 5 years ago

No attempt to install DBD::ODBC. What happens if you run connect to the container and run bash, like this:

docker run --rm -it --entrypoint /bin/bash sqitch/sqitch:snowflake

And then from inside the container, run this command:

/usr/bin/perl -MFindBin -E 'use lib "$FindBin::RealBin/../lib/perl5"; use DBD::ODBC; say DBD::ODBC->VERSION'

What does it output?

nabi-rd commented 5 years ago

1.60

nabi-rd commented 5 years ago

I think the problem is some missing configuration, do I need to configure ODB connection or Snowsql or if I pass connection parameters inline, it would be enough? e.g. sh docker-sqitch.sh status db:snowflake://myuser:mypassword@myaccountname/mydb

theory commented 5 years ago

That's certainly greater than 1.59. I don't know what the problem is. What is the exact error you get?

theory commented 5 years ago

You pass the parameters inline, usually something like

db:snowflake://myuser:mypassword@myaccountname/mydbn?Driver=Snowflake;warehouse=nabird

But even without that it should not complain about a version of DBD::ODBC that does not seem to be installed. I'm mystified.

nabi-rd commented 5 years ago

The latest error that I am getting is this: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) I think it is about the configuration not the driver itself. What do you think?

theory commented 5 years ago

Yes. be sure you include ?Driver=Snowflake in your URIs.

nabi-rd commented 5 years ago

Yeah I do that, but there is no need to configure /etc/odbcinst.ini or ~/.snowsql/config ?

theory commented 5 years ago

No. Could it be reading from an ODBC config file in the home directory of your host machine? Since the script mounts your local home directory as home in the container, it might mess with things a bit.

nabi-rd commented 5 years ago

What files it might read from the home directory? I removed ~/.snowsql/config and still no change. Any other config files that you might have in mind?

nabi-rd commented 5 years ago

@theory BTW, by adding ?Driver=Snowflake to the URL, the command will throw an error:

no matches found: db:snowflake://myuser:mypassword@account/mydb?Driver=Snowflake
theory commented 5 years ago

You need to quote it.

nabi-rd commented 5 years ago

yeah quoting it helped. Thanks for your help @theory, would be good to put usage instructions on the repo as well.

theory commented 5 years ago

So it works now? Usage depends on the engine, and all the docs are on the site.

nabi-rd commented 5 years ago

Getting the status worked, will need to test deploying a real change. Did a quick test on that and getting a different error, will test properly and share the update.

nabi-rd commented 5 years ago

@theory, when I try to deploy, I get this weird error:

250001 (08001): Failed to connect to DB. Verify the account name is correct: xxx
"snowsql" unexpectedly returned exit value 1

Where xxx is the first 3 characters of our Snowflake account! I am sure that the account name I am passing is correct and I am able to get the status.

theory commented 5 years ago

Are you able to connect via SnowSQL on the command-line? What does that look like?

nabi-rd commented 5 years ago

I am testing on a different machine now, the error is different here:

Adding registry tables to db:snowflake://user:@account/db?Driver=Snowflake
Path "/home/.snowsql/config" does not exist.
Try "snowsql --help" for more information.
"snowsql" unexpectedly returned exit value 2

I also tried running a container and then running snowsql and the error is the same (I did mount /home while running the container)

theory commented 5 years ago

So the connection via DBD::ODBC succeeds, that's good. What happens if you create that file? Might have to complain to Snowflake that SnowSQL doesn't run if the file does not exist. It really should not be necessary.

nabi-rd commented 5 years ago

Tried adding empty file, didn't help.

nabi-rd commented 5 years ago

Actually, adding an empty ~/.snowsql/config file to the host machine, takes me passed the file does not exist error but I still get Verify the account name is correct: xxx

theory commented 4 years ago

Please paste the complete output of the command you run. What happens when you try to run SnowSQL directly? You can try it by running this command:

docker run --rm -it --entrypoint "" sqitch/sqitch:snowflake

Then inside the container, run:

snowsql -c account --username user --dbname db
nabi-rd commented 4 years ago

Hi @theory, sorry I didn't I haven't replied in a long time. Been busy with other stuff. I think the issue here is that our Snowflake account name contains numeric characters and somehow your code is not able to handle that. Any suggestions based on similar issues that you have seen before?

theory commented 4 years ago

No problem. Think you could try the stuff I asked about above?

nabi-rd commented 4 years ago

I tried what you suggested, first of all your command for running the docker container does not work, had to change it to the following:

docker run --rm -it -v ~/.snowsql:/home/.snowsql --entrypoint /bin/bash sqitch/sqitch:snowflake

And the result of the second command is:

No connection could be found for [account_name]
If the error message is not clear, enable the logging using -o log_level=DEBUG and see the log to find out the cause. Contact the support for further help.
Goodbye!

But if I just type snowsql with no additional parameters, it asks for username and password interactively and lets me in.

nabi-rd commented 4 years ago

Any updates @theory?

theory commented 4 years ago

Sorry for the delayed reply, $day_job has been stupid busy and sucking up all my time. I confess that I'm a bit mystified. Were you able to get it to work with an account name without digits in it? What is in your ~/.snowsql/config? What exactly is the sqitch command you're executing?

venkatra commented 3 years ago

Hello with regards to Snowflake & docker image I was able to make it work. Infact figured out a method to have something generic. Presented this approach and the necessary changes in issue : #34