From e7edbc957b7f1333e5786900c8255088cb7634b3 Mon Sep 17 00:00:00 2001 From: Rishav Thapliyal Date: Wed, 11 Jun 2025 12:56:24 +0530 Subject: [PATCH] database version query --- dcs_core/core/datasource/sql_datasource.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dcs_core/core/datasource/sql_datasource.py b/dcs_core/core/datasource/sql_datasource.py index 93a235c9..7bddc8f7 100644 --- a/dcs_core/core/datasource/sql_datasource.py +++ b/dcs_core/core/datasource/sql_datasource.py @@ -174,6 +174,19 @@ def query_get_table_metadata(self) -> List[str]: """ return inspect(self.connection.engine).get_table_names() + def query_get_database_version(self) -> str: + """ + Get the database version + :return: version number + """ + query = "SELECT @@version" + result = self.fetchone(query)[0] + + if result: + return result + + return "Unknown version" + def query_get_row_count(self, table: str, filters: str = None) -> int: """ Get the row count