15 lines
398 B
Python
15 lines
398 B
Python
from os import getenv
|
|
|
|
import streamlit as st
|
|
from sqlalchemy.sql import text
|
|
from streamlit.connections import SQLConnection
|
|
|
|
|
|
def connection() -> SQLConnection:
|
|
_connection = st.connection("sql", url=getenv('DATABASE_URL'), ttl=0, autocommit=True)
|
|
with _connection.session as configured_session:
|
|
configured_session.execute(text('PRAGMA foreign_keys=ON'))
|
|
return _connection
|
|
|
|
|