sqitchers / docker-sqitch

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

DBD::ODBC 1.59 required to manage Snowflake #21

Closed sam-lime closed 4 years ago

sam-lime commented 4 years ago

Hi,

Big picture I am planning to integrate sqitch as part of CI/CD pipeline. For this, I am trying to run docker image locally for testing.

Issue I followed everything as documented here. When I run sh docker-sqitch.sh status db:snowflake://userName@acc_name/db_name?Driver=Snowflake;warehouse=wh, I get

"DBD::ODBC 1.59 required to manage Snowflake"

The only change I did was I replaced "_ADD https://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/linux_x86_64/snowsql-1.1.86-linux_x86_64.bash snowsql.bash_" with "_ADD https://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/linux_x86_64/snowsql-1.1.22-linux_x86_64.bash snowsql.bash_" because that key wasn't available.

I've referred few previous relevant discussions

  1. https://github.com/sqitchers/docker-sqitch/issues/12 which asks to run the cmd /usr/bin/perl -MFindBin -E 'use lib "$FindBin::RealBin/../lib/perl5"; use DBD::ODBC; say DBD::ODBC->VERSION' and I get 1.60
  2. and also https://github.com/sqitchers/sqitch/issues/439 which asks to run perl -MDBD::ODBC -E 1. On running this command inside container, I get following error message "_Can't locate DBD/ODBC.pm in @INC (you may need to install the DBD::ODBC module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x8664-linux-gnu/perl-base). BEGIN failed--compilation aborted."

Please let me know if I am missing something.

theory commented 4 years ago

Hrm. I just downloaded https://sfc-snowsql-updates.s3.us-west-2.amazonaws.com/bootstrap/1.1/linux_x86_64/snowsql-1.1.86-linux_x86_64.bash without a problem. No idea why the "key" wasn't available, but I'm trying to figure out how to get 1.2.2 to work, so watch for updates.

#1 shows that it finds DBD::ODBC just fine there. Good. Probably what's happening is it's not use the right container. Are you setting $SQITCH_IMAGE to the image name you've created (probably sqitch/sqitch:snowflake if you haven't set $REGISTRY):

SQITCH_IMAGE=sqitch/sqitch:snowflake docker-sqitch.sh status 'db:snowflake://userName@acc_name/db_name?Driver=Snowflake;warehouse=wh'

I'll add more notes to the README about this.

sam-lime commented 4 years ago

You were right about not using right container. Setting $SQITCH_IMAGE works. Thank you.

mdhatrika commented 4 years ago

Hi, I am planning to integrate sqitch as part of the CICD Pipeline, for this to happen I want to first set the sqitch locally to connect to snowflake. As part of the prerequisites, I use these 2 documents 1) To download the odbc driver for snowflake I followed this document and made setup and was able to connect to the snowflake successfully and following is the version it shows SQL> select current_client(); CURRENT_CLIENT()
| ODBC 2.21.3
https://support.snowflake.net/s/article/How-to-create-Snowflake-ODBC-DSN-On-MacOS 2) Downloaded and installed the snowsql using this document and was able to connect to snowflake succesfully https://docs.snowflake.com/en/user-guide/snowsql-install-config.html#installing-snowsql-on-macos-using-the-installer 3) For sqitch I refred to this document https://sqitch.org/docs/manual/sqitchtutorial-snowflake/

So the problem is when I try to do sqitch deploy I am getting this error DBD::ODBC 1.59 required to manage Snowflake **sqitch deploy 'db:snowflake://account_name/DBname?Driver=SnowflakeDSIIDriver'** I tried including the username and password in the above URI but still getting the same error. Please help me to figure out what I am doing wrong. Thanks