Skip to content

Commit bd7303c

Browse files
committed
initial commit 😈
1 parent 3456736 commit bd7303c

10 files changed

Lines changed: 24 additions & 17 deletions

File tree

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.formatting.provider": "black"
3+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ Codon is:
1111
- Maintained
1212
- Easily navigable
1313

14-
## Usage guide
14+
## Usage guide

codon/SQL Interface/BULK INSERT/DSS_CORPORATE_Python_Insert_Into.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@
2222
# commit transaction
2323
cnxn.commit()
2424

25-
print("Inserted Successfully")
25+
print("Inserted Successfully")
26+
27+
pyodbc.version
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
seaborn==0.9.0
1+
pyodbc==4.0.26

codon/SQL Interface/CREATE TABLE/DSS_CORPORATE_Python_CreateTable_Try.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
21
import pyodbc
32

43
# pyodbc connection
54
cnxn = pyodbc.connect('Driver={SQL Server};'
65
'Server=GLDMSRV009;'
76
'Database=DSS_CORPORATE;'
87
'Trusted_Connection=yes;')
8+
99
try:
1010
# Edit the SQL query to align to your table, schema and field constraints
1111
cursor = cnxn.cursor()
@@ -20,5 +20,6 @@
2020

2121
# Commit the transaction to 'save' the changes
2222
cnxn.commit()
23+
cnxn.close()
2324

2425

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
seaborn==0.9.0
1+
pyodbc==4.0.26

codon/SQL Interface/SELECT/requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

codon/SQL Interface/SELECT/DSS_CORPORATE_Python_Select.py renamed to codon/SQL Interface/py to sql/DSS_CORPORATE_Python_Select.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
import pyodbc
1+
import pyodbc
22

33
# pyodbc connection
4-
cnxn = pyodbc.connect('Driver={SQL Server};'
5-
'Server=GLDMSRV009;'
6-
'Database=DSS_CORPORATE;'
7-
'Trusted_Connection=yes;')
8-
9-
4+
conn = pyodbc.connect(
5+
"Driver={SQL Server};"
6+
"Server=GLDMSRV009;"
7+
"Database=DSS_CORPORATE;"
8+
"Trusted_Connection=yes;"
9+
)
10+
1011
# instantiate cursor
11-
cursor = cnxn.cursor()
12+
cur = conn.cursor()
1213

1314
# sql command string
1415
sql = """SELECT * FROM [DSS_CORPORATE].[dbo].[AD_Users2] WHERE [Pre_Windows_2000_Logon_Name] LIKE 'W%'"""
1516

1617
# execute sql
17-
cursor.execute(sql)
18+
cur.execute(sql)
1819

1920
# display rows held in cursor (no commit as no changes in sql database in this transaction)
20-
for row in cursor:
21+
for row in cur:
2122
print(row)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Title
22

3-
>Short description
3+
>This uses pyodbc - please read the docs
44
55
- __Description__ : Longer description
66
- __Published__ : dd/mm/YYYY
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyodbc==4.0.26

0 commit comments

Comments
 (0)