testcontainers / testcontainers/testcontainers-python
Use SqlServerContainer with pyodbc driver
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 2.3k
- Forks
- 386
- Merge medio
- 4 h 40 min
- PR fusionados (30 d)
- 1
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza revisando el diff del commit enlazado y el constructor actual de SqlServerContainer y la configuración de la conexión. Reproduce los ejemplos de pyodbc y sigue cómo se gestionan los argumentos de dialecto y controlador; se considera terminado cuando un SqlServerContainer puede conectarse con pyodbc y un controlador ODBC seleccionado explícitamente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python, sql
- Área
- databases
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100