Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds percona server for postgresql support #19322

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"""

POSTGRES_GET_SERVER_VERSION = """
show server_version
show server_version_num
"""

POSTGRES_FETCH_FK = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

logger = utils_logger()

OLD_POSTGRES_VERSION = "13.0"
OLD_POSTGRES_VERSION = "130000"


def get_etable_owner(
Expand Down Expand Up @@ -523,9 +523,6 @@ def get_postgres_version(engine) -> Optional[str]:
results = engine.execute(POSTGRES_GET_SERVER_VERSION)
for res in results:
version_string = str(res[0])
opening_parenthesis_index = version_string.find("(")
if opening_parenthesis_index != -1:
return version_string[:opening_parenthesis_index].strip()
return version_string
except Exception as err:
logger.warning(f"Unable to fetch the Postgres Version - {err}")
Expand Down
13 changes: 7 additions & 6 deletions ingestion/tests/unit/topology/database/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,15 @@ def test_datatype(self):

@patch("sqlalchemy.engine.base.Engine")
def test_get_version_info(self, engine):
engine.execute.return_value = [["15.3 (Debian 15.3-1.pgdg110+1)"]]
self.assertEqual("15.3", get_postgres_version(engine))
# outdated with a switch to get_server_version_num instead of get_+server_version
# engine.execute.return_value = [["15.3 (Debian 15.3-1.pgdg110+1)"]]
# self.assertEqual("15.3", get_postgres_version(engine))

engine.execute.return_value = [["11.16"]]
self.assertEqual("11.16", get_postgres_version(engine))
engine.execute.return_value = [["110016"]]
self.assertEqual("110016", get_postgres_version(engine))

engine.execute.return_value = [["9.6.24"]]
self.assertEqual("9.6.24", get_postgres_version(engine))
engine.execute.return_value = [["90624"]]
self.assertEqual("90624", get_postgres_version(engine))

engine.execute.return_value = [[]]
self.assertIsNone(get_postgres_version(engine))
Expand Down
Loading