MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / get_current_user

Function get_current_user

byod/api/app/setup/utils.py:88–105  ·  view source on GitHub ↗

Get current db user

()

Source from the content-addressed store, hash-verified

86
87
88def get_current_user():
89 """
90 Get current db user
91 """
92 try:
93 with ENGINE.connect() as connection:
94 connection = connection.execution_options(
95 postgresql_readonly=True
96 )
97 with connection.begin():
98 sql_text = text(f"""SELECT CURRENT_USER;""")
99 result = connection.execute(sql_text)
100 rows = [list(r) for r in result.all()]
101 return rows[0][0]
102
103 except Exception as e:
104 print(e)
105 return None
106
107
108def save_tables_metadata_to_db():

Callers 1

get_table_namesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected