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

Adapt to sqlachemy 2 #172

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Adapt to sqlachemy 2 #172

wants to merge 7 commits into from

Conversation

maxi-fort
Copy link
Collaborator

@maxi-fort maxi-fort commented Mar 10, 2025

SQL Achemy 2.0 introduces a new way of sending requests.
With this PR, every Openstef-dbc SQL queries have been adapted to this new syntax.

Additionally, integration tests are proposed. for each "get" method using SQL queries.

Signed-off-by: fortinmax <maxime.fortin@rte-france.com>
Signed-off-by: fortinmax <maxime.fortin@rte-france.com>
Signed-off-by: fortinmax <maxime.fortin@rte-france.com>
Signed-off-by: fortinmax <maxime.fortin@rte-france.com>
Signed-off-by: fortinmax <maxime.fortin@rte-france.com>
Signed-off-by: fortinmax <maxime.fortin@rte-france.com>
self.database = DataBase(config)

def test_sql_db_available(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change

assert self.di.check_sql_available() == True

def test_get_prediction_jobs(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change

assert isinstance(response[0], PredictionJobDataClass)

def test_get_pids_for_api_key(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change

assert isinstance(response, list)

def test_get_ean_for_pid(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change

assert isinstance(response, list)

def test_add_quantiles_to_prediction_jobs(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change

assert hasattr(response, "quantiles")

def test_get_systems_near_location(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blackfmt] reported by reviewdog 🐶

Suggested change

Signed-off-by: fortinmax <maxime.fortin@rte-france.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant