Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.cnxn = pyodbc.connect(self.connection_string)
self.cursor = self.cnxn.cursor()
for i in range(3):
try:
self.cursor.execute("drop table t%d" % i)
self.cnxn.commit()
except:
pass
for i in range(3):
try:
self.cursor.execute("drop procedure proc%d" % i)
self.cnxn.commit()
except:
pass
}
CONN_TEMPLATE_STR = ";".join(
[
"DRIVER={{ODBC Driver 17 for SQL Server}}",
"SERVER={server}",
"DATABASE={database}",
"UID={username}",
"PWD={password}",
"applicationintent={application_intent}",
],
)
conn_string = CONN_TEMPLATE_STR.format(**CONN_INFO)
SQL_ATTR_CONNECTION_TIMEOUT = 113
login_timeout = 2
connection_timeout = 2
cnx = pyodbc.connect(conn_string,
timeout=login_timeout,
attrs_before={
SQL_ATTR_CONNECTION_TIMEOUT: connection_timeout,
})
cursor = cnx.cursor()
if args.query.strip() == "":
exit()
cursor.execute(args.query)
for row in cursor:
print(row)
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.
def test_version(self):
self.assertEqual(3, len(pyodbc.version.split('.'))) # 1.3.1 etc.