Amazon Redshift は、2025 年 11 月 1 日以降、新しい Python UDF の作成をサポートしなくなります。Python UDF を使用する場合は、その日付より前に UDF を作成してください。既存の Python UDF は引き続き通常どおり機能します。詳細については、ブログ記事
Amazon Redshift Python コネクタの API リファレンス
Amazon Redshift Python コネクタ API オペレーションの説明は次のとおりです。
redshift_connector
redshift_connectorAPI オペレーションの説明は次のとおりです。
connect(user, database, password[, port, …])-
Amazon Redshift クラスターへの接続を確立します。この関数は、ユーザー入力を検証し、必要に応じて アイデンティティプロバイダープラグインを使用して認証し、接続オブジェクトを作成します。
apilevel-
現在サポートされている DBAPI レベルは「2.0」です。
paramstylestr(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str-
グローバルに使用するデータベース API パラメータスタイル。
接続
Amazon Redshift Python コネクタの接続 API オペレーションの説明は次のとおりです。
__init__(user, password, database[, host, …])-
生の接続オブジェクトを初期化します。
cursor-
この接続にバインドされたカーソルオブジェクトを作成します。
commit-
現在のデータベーストランザクションをコミットします。
rollback-
現在のデータベーストランザクションをロールバックします。
close-
データベース接続を閉じます。
execute(cursor, operation, vals)-
指定された SQL コマンドを実行します。
redshift_connector.paramstyleの値に応じて、パラメータをシーケンスまたはマッピングとして提供することができます。 run(sql[, stream])-
指定された SQL コマンドを実行します。オプションで、COPY コマンドで使用するストリーミングを指定することができます。
xid(format_id, global_transaction_id, …)-
トランザクション ID を作成します。
global_transaction_idパラメータのみが postgres で使用されます。format_id と branch_qualifier は postgres では使用されません。global_transaction_idは、タプル(format_id、global_transaction_id、branch_qualifier)を返す postgres がサポートする任意の文字列識別子とすることができます。 tpc_begin(xid)-
フォーマット ID、グローバルトランザクション ID、ブランチクオリファイアで構成されるトランザクション ID
xidで、TPC トランザクションを開始します。 tpc_prepare-
.tpc_begin で開始されたトランザクションの最初のフェーズを実行します。
tpc_commit([xid])-
引数なしで呼び出された場合、.tpc_commit は、以前に.tpc_prepare () で準備された TPC トランザクションをコミットします。
tpc_rollback([xid])-
引数なしで呼び出されると、.tpc_rollback は TPC トランザクションをロールバックします。
tpc_recover-
.tpc_commit (xid) または.tpc_rollback (xid) での使用に適した保留中のトランザクション ID のリストを返します。
カーソル
カーソル API オペレーションの説明は次のとおりです。
__init__(connection[, paramstyle])-
生のカーソルオブジェクトを初期化します。
insert_data_bulk(filename, table_name, parameter_indices, column_names, delimiter, batch_size)-
一括 INSERT ステートメントを実行します。
execute(operation[, args, stream, …])-
データベースオペレーションを実行します。
executemany(operation, param_sets)-
データベースオペレーションを準備し、指定されたすべてのパラメータシーケンスまたはマッピングに対して実行します。
fetchone-
クエリの結果セットの次の行を取得します。
fetchmany([num])-
クエリ結果の次の行のセットを取得します。
fetchall-
クエリ結果の残りのすべての行を取得します。
close-
今すぐカーソルを閉じます。
__iter__-
カーソルオブジェクトを反復処理して、クエリから行を取得できます。
fetch_dataframe([num])-
最後のクエリ結果のデータフレームを返します。
write_dataframe(df, table)-
同じ構造データフレームを Amazon Redshift データベースに書き込みます。
fetch_numpy_array([num])-
最後のクエリ結果の NumPy 配列を返します。
get_catalogs-
Amazon Redshift は、1 つの接続で複数のカタログをサポートしていません。Amazon Redshift は現在のカタログのみを返します。
get_tables([catalog, schema_pattern, …])-
システム内でユーザー定義された固有のパブリックテーブルを返します。
get_columns([catalog, schema_pattern, …])-
Amazon Redshift データベース内の特定のテーブルのすべての列のリストを返します。
AdfsCredentials プロバイダープラグイン
Amazon Redshift Python コネクタの AdfsCredentials プロバイダープラグイン API オペレーションの構文を次に示します。
redshift_connector.plugin.AdfsCredentialsProvider()
AzureCredentials プロバイダープラグイン
Amazon Redshift Python コネクタの AzureCredentials プロバイダープラグイン API オペレーションの構文を次に示します。
redshift_connector.plugin.AzureCredentialsProvider()
ブラウザ AzureCredentials プロバイダープラグイン
Amazon Redshift Python コネクタのBrowserAzureCredentials プロバイダープラグイン API オペレーションの構文を以下に示します。
redshift_connector.plugin.BrowserAzureCredentialsProvider()
BrowserSamlCredentials プロバイダープラグイン
Amazon Redshift Python コネクタの BrowserSamlCredentials プロバイダープラグイン API オペレーションの構文は以下のとおりです。
redshift_connector.plugin.BrowserSamlCredentialsProvider()
Oktacredentials プロバイダープラグイン
Amazon Redshift Python コネクタの OktaCredentials プロバイダープラグイン API オペレーションの構文を次に示します。
redshift_connector.plugin.OktaCredentialsProvider()
PingCredentials プロバイダープラグイン
Amazon Redshift Python コネクタの PingCredentials プロバイダー プラグイン API オペレーションの構文を次に示します。
redshift_connector.plugin.PingCredentialsProvider()
SamlCredentials プロバイダープラグイン
Amazon Redshift Python コネクタの SamlCredentials プロバイダープラグイン API オペレーションの構文を次に示します。
redshift_connector.plugin.SamlCredentialsProvider()