我与服务器上的雪花有odbc连接。它使用了一把钥匙,而且工作得很好。
与此无关,我想根据这些指令在ubuntu上设置斯诺set。特别是,我正在尝试填充配置文件。
我所拥有的和我在下面尝试的是我的实际odbc和config的陷阱化版本,这里有一个伪密码。
我在其他地方工作的odbc:
[snowflake]
Description=SnowflakeDB
Driver=SnowflakeDSIIDriver
Locale=en-US
SERVER=ourcompanyname.us-east-1.snowflakecomputing.com
PORT=443
SSL=on
ACCOUNT=ourcompanyname.us-east-1
UID=MY_NAME
PRIV_KEY_FILE=/home/myname/keys/rsa_key.p8
PRIV_KEY_FILE_PWD=mypassword
AUTHENTICATOR=SNOWFLAKE_JWT
LogLevel=6
CurlVerboseMode=true
LogPath=/tmp安装SnowSQL时自动生成的配置文件如下所示:
cat config
[connections]
# *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
#
# The Snowflake user password is stored in plain text in this file.
# Pay special attention to the management of this file.
# Thank you.
#
# *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
#If a connection doesn't specify a value, it will default to these
#
#accountname = defaultaccount
#region = defaultregion
#username = defaultuser
#password = defaultpassword
#dbname = defaultdbname
#schemaname = defaultschema
#warehousename = defaultwarehouse
#rolename = defaultrolename
#proxy_host = defaultproxyhost
#proxy_port = defaultproxyport
[connections.example]
#Can be used in SnowSql as #connect example
accountname = accountname
username = username
password = password1234
[variables]
#Loads these variables on startup
#Can be used in SnowSql as select $example_variable
example_variable=27
[options]
# If set to false auto-completion will not occur interactive mode.
auto_completion = True
# main log file location. The file includes the log from SnowSQL main
# executable.
log_file = ../snowsql_rt.log
# bootstrap log file location. The file includes the log from SnowSQL bootstrap
# executable.
# log_bootstrap_file = ~/.snowsql/log_bootstrap
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
# and "DEBUG".
log_level = DEBUG
# Timing of sql statments and table rendering.
timing = True
# Table format. Possible values: psql, plain, simple, grid, fancy_grid, pipe,
# orgtbl, rst, mediawiki, html, latex, latex_booktabs, tsv.
# Recommended: psql, fancy_grid and grid.
output_format = psql
# Keybindings: Possible values: emacs, vi.
# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
key_bindings = emacs
# OCSP Fail Open Mode.
# The only OCSP scenario which will lead to connection failure would be OCSP response with a
# revoked status. Any other errors or in the OCSP module will not raise an error.
# ocsp_fail_open = True
# Enable temporary credential file for Linux users
# For Linux users, since there are no OS-key-store, an unsecure temporary credential for SSO can be enabled by this option. The default value for this option is False.
# client_store_temporary_credential = True
# Repository Base URL
# The endpoint to download the SnowSQL main module.
repository_base_url = https://sfc-repo.snowflakecomputing.com/snowsql我希望尽可能地将从我的工作odbc到斯诺see配置的参数进行匹配,看看它是否连接到了我。试过:
[connections]
# *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
#
# The Snowflake user password is stored in plain text in this file.
# Pay special attention to the management of this file.
# Thank you.
#
# *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*
#If a connection doesn't specify a value, it will default to these
#
#accountname = defaultaccount
#region = defaultregion
#username = defaultuser
#password = defaultpassword
#dbname = defaultdbname
#schemaname = defaultschema
#warehousename = defaultwarehouse
#rolename = defaultrolename
#proxy_host = defaultproxyhost
#proxy_port = defaultproxyport
[connections.ourcompany]
#Can be used in SnowSql as #connect example
Description=SnowflakeDB
Driver=SnowflakeDSIIDriver
Locale=en-US
SERVER=ourcompanyname.us-east-1.snowflakecomputing.com
PORT=443
SSL=on
ACCOUNT=ourcompanyname.us-east-1
UID=MY_NAME
PRIV_KEY_FILE=/home/myname/keys/rsa_key.p8
PRIV_KEY_FILE_PWD=mypassword
AUTHENTICATOR=SNOWFLAKE_JWT
LogLevel=6
CurlVerboseMode=true
LogPath=/tmp
[variables]
#Loads these variables on startup
#Can be used in SnowSql as select $example_variable
example_variable=27
[options]
# If set to false auto-completion will not occur interactive mode.
auto_completion = True
# main log file location. The file includes the log from SnowSQL main
# executable.
log_file = /home/snowflake/snowsql_rt.log
# bootstrap log file location. The file includes the log from SnowSQL bootstrap
# executable.
log_bootstrap_file = /home/snowflake/.snowsql/log_bootstrap
# Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO"
# and "DEBUG".
log_level = DEBUG
# Timing of sql statments and table rendering.
timing = True
# Table format. Possible values: psql, plain, simple, grid, fancy_grid, pipe,
# orgtbl, rst, mediawiki, html, latex, latex_booktabs, tsv.
# Recommended: psql, fancy_grid and grid.
output_format = psql
# Keybindings: Possible values: emacs, vi.
# Emacs mode: Ctrl-A is home, Ctrl-E is end. All emacs keybindings are available in the REPL.
# When Vi mode is enabled you can use modal editing features offered by Vi in the REPL.
key_bindings = emacs
# OCSP Fail Open Mode.
# The only OCSP scenario which will lead to connection failure would be OCSP response with a
# revoked status. Any other errors or in the OCSP module will not raise an error.
# ocsp_fail_open = True
# Enable temporary credential file for Linux users
# For Linux users, since there are no OS-key-store, an unsecure temporary credential for SSO can be enabled by this option. The default value for this option is False.
# client_store_temporary_credential = True
# Repository Base URL
# The endpoint to download the SnowSQL main module.
repository_base_url = https://sfc-repo.snowflakecomputing.com/snowsql在服务器(docker容器)上运行此操作后,我尝试运行斯诺try,没有收到任何错误消息或其他任何信息,只得到配置选项列表:
snowflake@ab9069d6b0fb:~$ snowsql
Usage: snowsql [OPTIONS]
Options:
-a, --accountname TEXT Name assigned to your Snowflake account. If
you are not on us-west-2 or AWS deployement,
append the region and platform to the end,
e.g., <account>.<region> or
<account>.<region>.<platform>Honors
$SNOWSQL_ACCOUNT.
-u, --username TEXT Username to connect to Snowflake. Honors
$SNOWSQL_USER.
-d, --dbname TEXT Database to use. Honors $SNOWSQL_DATABASE.
-s, --schemaname TEXT Schema in the database to use. Honors
$SNOWSQL_SCHEMA.
-r, --rolename TEXT Role name to use. Honors $SNOWSQL_ROLE.
-w, --warehouse TEXT Warehouse to use. Honors $SNOWSQL_WAREHOUSE.
-h, --host TEXT Host address for the connection. Honors
$SNOWSQL_HOST.
-p, --port INTEGER Port number for the connection. Honors
$SNOWSQL_PORT.
--region TEXT (DEPRECATED) Append the region or any sub
domains before snowflakecomputing.com to the
end of accountname parameter after a dot.
e.g., accountname=<account>.<region>
-m, --mfa-passcode TEXT Token to use for multi-factor authentication
(MFA)
--mfa-passcode-in-password Appends the MFA passcode to the end of the
password.
--abort-detached-query Aborts a query if the connection between the
client and server is lost. By default, it
won't abort even if the connection is lost.
--probe-connection Test connectivity to Snowflake. This option
is mainly used to print out the TLS/SSL
certificate chain.
--proxy-host TEXT (DEPRECATED. Use HTTPS_PROXY and HTTP_PROXY
environment variables.) Proxy server
hostname. Honors $SNOWSQL_PROXY_HOST.
--proxy-port INTEGER (DEPRECATED. Use HTTPS_PROXY and HTTP_PROXY
environment variables.) Proxy server port
number. Honors $SNOWSQL_PROXY_PORT.
--proxy-user TEXT (DEPRECATED. Use HTTPS_PROXY and HTTP_PROXY
environment variables.) Proxy server
username. Honors $SNOWSQL_PROXY_USER. Set
$SNOWSQL_PROXY_PWD for the proxy server
password.
--authenticator TEXT Authenticator: 'snowflake',
'externalbrowser' (to use any IdP and a web
browser), 'oauth', or
https://<your_okta_account_name>.okta.com
(to use Okta natively).
-v, --version Shows the current SnowSQL version, or uses a
specific version if provided as a value.
--noup Disables auto-upgrade for this run. If no
version is specified for -v, the latest
version in ~/.snowsql/ is used.
-D, --variable TEXT Sets a variable to be referred by &<var>. -D
tablename=CENUSTRACKONE or --variable
db_key=$DB_KEY
-o, --option TEXT Set SnowSQL options. See the options
reference in the Snowflake documentation.
-f, --filename FILE File to execute.
-q, --query TEXT Query to execute.
--config FILE Path and name of the SnowSQL configuration
file. By default, ~/.snowsql/config.
-P, --prompt Forces a password prompt. By default,
$SNOWSQL_PWD is used to set the password.
-M, --mfa-prompt Forces a prompt for the second token for
MFA.
-c, --connection TEXT Named set of connection parameters to use.
--single-transaction Connects with autocommit disabled. Wraps
BEGIN/COMMIT around statements to execute
them as a single transaction, ensuring all
commands complete successfully or no change
is applied.
--private-key-path PATH Path to private key file in PEM format used
for key pair authentication. Private key
file is required to be encrypted and
passphrase is required to be specified in
environment variable
$SNOWSQL_PRIVATE_KEY_PASSPHRASE
-U, --upgrade Force upgrade of SnowSQL to the latest
version.
-K, --client-session-keep-alive
Keep the session active indefinitely, even
if there is no activity from the user..
--disable-request-pooling Disable request pooling. This can help speed
up connection failover
--token TEXT The token to be used with oauth
authentication method
--generate-jwt Generate a jwt token, which will be printed
out and displayed. Requires values for user,
account, and private-key-path.
-?, --help Show this message and exit.如何将odbc详细信息转换为斯诺can?如果可以的话?我能知道发生了什么或者为什么我不能用snowsql打开sql吗?
在/snowsql目录log_bootstrap中有一个文件,我看了一下,但是没有看到任何指向我的东西,也许我漏掉了什么?
snowflake@ab9069d6b0fb:~/.snowsql$ cat log_bootstrap
2021-08-03 18:53:39,772 (14/MainThread) snowflake.cli.common.util_cli DEBUG util_cli:645 - Initialized logging. Log file '/home/snowflake/.snowsql/log_bootstrap', Namespaces: ['snowflake.cli', 'snowflake.connector', 'botocore', 'azure', '__main__', 'eventloop', 'sqlexecute']
2021-08-03 18:53:39,772 (14/MainThread) snowflake.cli.common.util_cli DEBUG util_cli:664 - cacert?: /tmp/_MEIrQ3COj/base_library.zip/cacert.pem, /tmp/_MEIrQ3COj/base_library.zip/certifi/cacert.pem
2021-08-03 18:53:39,772 (14/MainThread) snowflake.cli.common.util_cli DEBUG util_cli:664 - cacert?: /tmp/_MEIrQ3COj/cacert.pem, /tmp/_MEIrQ3COj/certifi/cacert.pem
2021-08-03 18:53:39,772 (14/MainThread) snowflake.cli.common.util_cli INFO util_cli:673 - cacert.pem is set to REQUESTS_CA_BUNDLE: /tmp/_MEIrQ3COj/certifi/cacert.pem
2021-08-03 18:53:39,772 (14/MainThread) __main__ DEBUG bootstrap:346 - proxy_host:None, proxy_port: None, proxy_user: None, proxy_password:False
2021-08-03 18:53:39,772 (14/MainThread) __main__ INFO bootstrap:348 - no autoupgrade option: False
2021-08-03 18:53:39,772 (14/MainThread) __main__ INFO bootstrap:350 - version: None, ret_options: None
2021-08-03 18:53:39,773 (14/MainThread) __main__ DEBUG bootstrap:738 - No deletion happened. The number of snowsql is still less than 5
2021-08-03 18:53:39,773 (14/MainThread) __main__ DEBUG bootstrap:363 - can we upgrade?: True
2021-08-03 18:53:39,773 (14/MainThread) __main__ INFO bootstrap:368 - auto upgrade without version
2021-08-03 18:53:39,773 (14/MainThread) __main__ DEBUG bootstrap:892 - Checking Repository: https://sfc-repo.snowflakecomputing.com/snowsql/1.2/linux_x86_64/index.json
2021-08-03 18:53:40,239 (14/MainThread) __main__ DEBUG bootstrap:908 - List Objects: [
"snowsql-1.2.17-linux_x86_64.zip",
"snowsql-1.2.16-linux_x86_64.zip",
"snowsql-1.2.15-linux_x86_64.zip",
"snowsql-1.2.14-linux_x86_64.zip",
"snowsql-1.2.13-linux_x86_64.zip",
"snowsql-1.2.12-linux_x86_64.zip",
"snowsql-1.2.11-linux_x86_64.zip",
"snowsql-1.2.10-linux_x86_64.zip",
"snowsql-1.2.9-linux_x86_64.zip",
"snowsql-1.2.8-linux_x86_64.zip",
"snowsql-1.2.7-linux_x86_64.zip",
"snowsql-1.2.5-linux_x86_64.zip",
"snowsql-1.2.4-linux_x86_64.zip",
"snowsql-1.2.3-linux_x86_64.zip",
"snowsql-1.2.2-linux_x86_64.zip",
"snowsql-1.2.1-linux_x86_64.zip",
"snowsql-1.2.0-linux_x86_64.zip"
]
2021-08-03 18:53:40,240 (14/MainThread) __main__ DEBUG bootstrap:931 - extracting from sfc-repo bucket
2021-08-03 18:53:40,240 (14/MainThread) __main__ DEBUG bootstrap:794 - Available snowsql files: ['1.2/linux_x86_64/snowsql-1.2.17-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.16-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.15-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.14-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.13-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.12-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.11-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.10-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.9-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.8-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.7-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.5-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.4-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.3-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.2-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.1-linux_x86_64.zip', '1.2/linux_x86_64/snowsql-1.2.0-linux_x86_64.zip']
2021-08-03 18:53:40,240 (14/MainThread) __main__ DEBUG bootstrap:795 - snowsql file: 1.2/linux_x86_64/snowsql-1.2.17-linux_x86_64.zip
2021-08-03 18:53:40,240 (14/MainThread) __main__ DEBUG bootstrap:621 - Latest version: 1.2.17 in remote
2021-08-03 18:53:40,240 (14/MainThread) __main__ INFO bootstrap:245 - Recorded autoupgrade status
2021-08-03 18:53:40,240 (14/MainThread) __main__ DEBUG bootstrap:814 - Running /home/snowflake/.snowsql/1.2.17/snowsql
snowflake@ab9069d6b0fb:~/.snowsql$ ls -l发布于 2021-08-03 19:45:59
类似于几乎每个命令行命令,SnowSQL不会提示您提供它需要的任何选项,如果您不提供它需要的选项,它将列出这些选项。
您需要提供连接到特定帐户所需的最小信息。在大多数情况下,这最终是-a选项,尽管如果您的配置文件中有一个默认帐户,它将运行这个帐户(假设SnowSQL可以找到您的配置文件)。
https://stackoverflow.com/questions/68641477
复制相似问题