Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pip install pymssql
- from os import getenv
- import pymssql
- server = getenv("PYMSSQL_TEST_SERVER")
- user = getenv("PYMSSQL_TEST_USERNAME")
- password = getenv("PYMSSQL_TEST_PASSWORD")
- conn = pymssql.connect(server, user, password, "tempdb")
- cursor = conn.cursor()
- cursor.executemany(
- "INSERT INTO persons VALUES (%d, %s, %s)",
- [(1, 'John Smith', 'John Doe'),
- (2, 'Jane Doe', 'Joe Dog'),
- (3, 'Mike T.', 'Sarah H.')])
- # you must call commit() to persist your data if you don't set autocommit to True
- conn.commit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement