File size: 600 Bytes
74ac7c0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# modules/db_connection.py
import pymssql
from azure.identity import DefaultAzureCredential
def get_db_connection():
server = 'aideatexdb.database.windows.net'
database = 'textdb'
username = 'manuel.var.ale_aideatext.ai#EXT#@manuelvaraleaideatext.onmicrosoft.com'
credential = DefaultAzureCredential()
token = credential.get_token("https://database.windows.net/.default")
conn = pymssql.connect(server=server,
database=database,
user=username,
password=token.token)
return conn |