Skip to content

Commit

Permalink
conn
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopocarlini committed Oct 17, 2023
1 parent af62620 commit 4e18333
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.idea/
*.iml
/helm/charts/
/helm/Chart.lock
38 changes: 38 additions & 0 deletions connect_oracle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import os

import oracledb

connection = oracledb.connect(
dsn="db-nodo-pagamenti.d.db-nodo-pagamenti.com/NDPSPCT_PP_NODO4_CFG",
port=1522,
user=os.environ['SPRING_DATASOURCE_USERNAME'],
password=os.environ['SPRING_DATASOURCE_PASSWORD']
)

print("Successfully connected to Oracle Database")

print("Creating cursor...")
cursor = connection.cursor()
print("Cursor created")

print("Executing query...")
mapping = []
i = 0
sqlQuery = str("""
SELECT
p.ID_PSP,
p.ABI
FROM
NODO4_CFG.PSP p
WHERE
p.ID_PSP NOT LIKE '%CHARITY%'
ORDER BY p.ID_PSP
""")

for row in cursor.execute(sqlQuery):
mapping.append(row)
i += 1

connection.close()

print("Found {} bundles that match the query".format(i))
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Flask==3.0.0
oracledb==1.4.2

0 comments on commit 4e18333

Please sign in to comment.