Python 3 that's SQL Server ready, with MS ODBC drivers and tools installed
325
Sample file:
import pyodbc
server='my-sql-server-host'
username='my_user'
password='my_pass'
database='my_db'
table='dbo.my_table'
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';PORT=1433;DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
with cursor.execute(f'SELECT * FROM {table}'):
row = cursor.fetchone()
while row:
print (row)
row = cursor.fetchone()
To run an standalone ipython session:
docker run --rm -it --net host joshjones/python-sqlserver
To run some code:
docker run --rm --net host -v $(pwd)/my_file.py:/my_file.py joshjones/python-sqlserver my_file.py
Content type
Image
Digest
Size
376.8 MB
Last updated
almost 8 years ago
docker pull joshjones/python-sqlserver