Skip to content

Commit 5c76d04

Browse files
authored
Improve pymssql instrumentation examples (#3473)
1 parent 9d41f9b commit 5c76d04

File tree

1 file changed

+4
-2
lines changed
  • instrumentation/opentelemetry-instrumentation-pymssql/src/opentelemetry/instrumentation/pymssql

1 file changed

+4
-2
lines changed

instrumentation/opentelemetry-instrumentation-pymssql/src/opentelemetry/instrumentation/pymssql/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
3131
cnx = pymssql.connect(database="MSSQL_Database")
3232
cursor = cnx.cursor()
33-
cursor.execute("INSERT INTO test (testField) VALUES (123)"
33+
cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
34+
cursor.execute("INSERT INTO test (testField) VALUES (123)")
3435
cnx.commit()
3536
cursor.close()
3637
cnx.close()
@@ -44,7 +45,8 @@
4445
cnx = pymssql.connect(database="MSSQL_Database")
4546
instrumented_cnx = PyMSSQLInstrumentor().instrument_connection(cnx)
4647
cursor = instrumented_cnx.cursor()
47-
cursor.execute("INSERT INTO test (testField) VALUES (123)"
48+
cursor.execute("CREATE TABLE IF NOT EXISTS test (testField INTEGER)")
49+
cursor.execute("INSERT INTO test (testField) VALUES (123)")
4850
instrumented_cnx.commit()
4951
cursor.close()
5052
instrumented_cnx.close()

0 commit comments

Comments
 (0)