# 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 |