testcontainers / testcontainers/testcontainers-python
Use SqlServerContainer with pyodbc driver
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 2.3k
- フォーク
- 386
- 平均マージ
- 4時間 40分
- マージ済み PR(30日)
- 1
説明
In https://github.com/testcontainers/testcontainers-python/commit/fc5f2df4ba8157d21ecbf3a9a90cd45a61049f90#diff-313a71bf8d0b95ccd84a98f198294e10a7c7086c527efb513d9c6619a12086ee the default driver of SqlServerContainer was changed to pymssql.
Currently, I use the pyodbc driver to communicate with MSSQL databases. This is not possible anymore since then. I've tried
test_container = SqlServerContainer(
image="mcr.microsoft.com/mssql/server:2017-latest",
dialect="mssql+pyodbc",
)
which leads to a timeout
testcontainers.core.exceptions.TimeoutException: Wait time (120s) exceeded for _connect(args: (), kwargs {}). Exception: (pyodbc.InterfaceError) ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')
Alternatively, I've tried to specify the driver
test_container = SqlServerContainer(
image="mcr.microsoft.com/mssql/server:2017-latest",
dialect="mssql+pyodbc",
driver = "ODBC Driver 17 for SQL Server"
)
but this keyword isn't allowed anymore.
> raise create_unexpected_kwargs_error('run', kwargs)
E TypeError: run() got an unexpected keyword argument 'driver'
Is it still the goal of testcontainers to support using the pyodbc driver? If so, I might be motivated to support a little bit making this possible again in 3.6.x versions.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされたコミットの差分と、現在の SqlServerContainer コンストラクターおよび接続設定を確認することから始めてください。pyodbc の例を再現し、dialect と driver の引数がどのように処理されるかを追跡してください。SqlServerContainer が pyodbc と明示的に選択した ODBC ドライバーで接続できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python, sql
- 領域
- databases
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100