MCPcopy Index your code
hub / github.com/dataease/SQLBot / get_session

Function get_session

backend/apps/db/db.py:168–177  ·  view source on GitHub ↗
(ds: CoreDatasource | AssistantOutDsSchema)

Source from the content-addressed store, hash-verified

166
167
168def get_session(ds: CoreDatasource | AssistantOutDsSchema):
169 # engine = get_engine(ds) if isinstance(ds, CoreDatasource) else get_ds_engine(ds)
170 if isinstance(ds, AssistantOutDsSchema):
171 out_conf = get_out_ds_conf(ds, 30)
172 ds.configuration = out_conf
173
174 engine = get_engine(ds)
175 session_maker = sessionmaker(bind=engine)
176 session = session_maker()
177 return session
178
179
180def check_connection(trans: Optional[Trans], ds: CoreDatasource | AssistantOutDsSchema, is_raise: bool = False):

Callers 5

get_versionFunction · 0.70
get_schemaFunction · 0.70
get_tablesFunction · 0.70
get_fieldsFunction · 0.70
exec_sqlFunction · 0.70

Calls 2

get_out_ds_confFunction · 0.90
get_engineFunction · 0.85

Tested by

no test coverage detected