snow helpers import-snowsql-connections

SnowSQL の構成から既存の接続をインポートします。

構文

snow helpers import-snowsql-connections
  --snowsql-config-file <custom_snowsql_config_files>
  --default-connection-name <default_cli_connection_name>
  --format <format>
  --verbose
  --debug
  --silent
Copy

引数

なし

オプション

--snowsql-config-file FILE

カスタム SnowSQL 構成へのファイルパスを指定します。このオプションは、複数のファイルを指定するために複数回使用することができます。

--default-connection-name TEXT

SnowSQL からインポートされたデフォルト接続に Snowflake CLI で与えられる名前を指定します。デフォルト: デフォルト

--format [TABLE|JSON]

出力形式を指定します。デフォルト: TABLE

--verbose, -v

ログレベル info 以上のログエントリを表示します。デフォルト: false。

--debug

ログレベル debug 以上のログ エントリを表示します。デバッグログには追加情報が含まれます。デフォルト: false。

--silent

コンソールへの中間出力をオフにします。デフォルト: false。

--help

このコマンドのヘルプテキストを表示します。

使用上の注意

codenowrap:snow helpers import-snowsql-connections コマンドは、既存の接続定義を SnowSQL から:codenowrap:config.toml 構成ファイルにインポートします。

デフォルトでは、コマンドは Configuring SnowSQL のトピックで説明されている順序でSnowSQL 構成ファイルを読み込みます。複数の構成が同じ接続を定義している場合、このコマンドは、以前にインポートされた接続定義を最新のもので上書きします。説明のために、同じ:codenowrap:[connections.example] 接続が、以下の場所に異なるパラメーターで定義されているとします。

構成ファイルの場所

接続定義

/etc/snowsql.cnf

[connections]

[connections.example]
username=user1
Copy

<HOME_DIR>/.snowsql/config

[connections]

[connections.example]
username=user2
password=<my-pwd>
Copy

コマンドを実行すると、 Snowflake CLI config.toml ファイルに以下の:codenowrap:[connections.example] 定義が含まれます(優先順位の高いファイルから):

[connections]

[connections.example]
username=user2
password=<my-pwd>
Copy

--snowsql-config-file オプションを使用すると、このデフォルトの動作をオーバーライドし、代わりに1つ以上の特定の SnowSQL 構成ファイルからインポートすることができます。

snow helpers import-snowsql-connections コマンドは、名前付き接続ではない SnowSQL からのデフォルト接続もインポートします。これは構成ファイルの:codenowrap:[connections] セクションで直接定義されます。 Snowflake CLI はすべての接続に名前を付ける必要があるため、コマンドは:codenowrap:[default] という名前の接続を定義します。デフォルト接続に別の名前を使いたい場合は、--default-connection-name オプションで指定できます。

SnowSQL 接続が既存の Snowflake CLI 接続の名前と一致する場合、コマンド・プロンプトが既存の接続を上書きするか、その SnowSQL 接続のインポートをスキップするかを尋ねます。

以下の例では、標準構成ファイルの場所から SnowSQL 接続をインポートしています:

snow helpers import-snowsql-connections
Copy

コマンドは SnowSQL 構成ファイルを処理する際、進行状況を表示し、 Snowflake CLI config.toml ファイルに同名の接続が既に定義されている場合は確認を求めます。

SnowSQL config file [/etc/snowsql.cnf] does not exist. Skipping.
SnowSQL config file [/etc/snowflake/snowsql.cnf] does not exist. Skipping.
SnowSQL config file [/usr/local/etc/snowsql.cnf] does not exist. Skipping.
Trying to read connections from [/Users/<user>/.snowsql.cnf].
Reading SnowSQL's connection configuration [connections.connection1] from [/Users/<user>/.snowsql.cnf]
Trying to read connections from [/Users/<user>/.snowsql/config].
Reading SnowSQL's default connection configuration from [/Users/<user>/.snowsql/config]
Reading SnowSQL's connection configuration [connections.connection1] from [/Users/<user>/.snowsql/config]
Reading SnowSQL's connection configuration [connections.connection2] from [/Users/<user>/.snowsql/config]
Connection 'connection1' already exists in Snowflake CLI, do you want to use SnowSQL definition and override existing connection in Snowflake CLI? [y/N]: Y
Connection 'connection2' already exists in Snowflake CLI, do you want to use SnowSQL definition and override existing connection in Snowflake CLI? [y/N]: n
Connection 'default' already exists in Snowflake CLI, do you want to use SnowSQL definition and override existing connection in Snowflake CLI? [y/N]: n
Saving [connection1] connection in Snowflake CLI's config.
Connections successfully imported from SnowSQL to Snowflake CLI.