From 6a8bb4798a43fe63c40399dfd2036146903a771f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:29:43 -0700 Subject: [PATCH] build(deps): bump sqlalchemy from 1.4.52 to 2.0.36; move to sqlalchemy.text for queries (#469) * build(deps): bump sqlalchemy from 1.4.52 to 2.0.36 Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 1.4.52 to 2.0.36. - [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases) - [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst) - [Commits](https://github.com/sqlalchemy/sqlalchemy/commits) --- updated-dependencies: - dependency-name: sqlalchemy dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * use sqlalchemy.text for queries * remove sqlalchemy uber warning Co-Authored-By: Ken Brewer * reupdate lockfile --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: d33bs Co-authored-by: Ken Brewer --- .github/workflows/integration-test.yml | 4 ---- poetry.lock | 2 +- pycytominer/cyto_utils/cells.py | 9 ++++----- pyproject.toml | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 8327e502..b498e882 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -91,10 +91,6 @@ jobs: runs-on: ${{ matrix.os }} env: OS: ${{ matrix.os }} - # This is needed to avoid a warning from SQLAlchemy - # https://sqlalche.me/e/b8d9 - # We can remove this once we upgrade to SQLAlchemy >= 2.0 - SQLALCHEMY_SILENCE_UBER_WARNING: "1" if: github.event_name != 'schedule' steps: - name: Checkout repo diff --git a/poetry.lock b/poetry.lock index a3f3dbe5..3f887e01 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4266,4 +4266,4 @@ collate = ["cytominer-database"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<3.12" -content-hash = "314ec75ba3a5d74ee90fef29ca8bd7d3f7b07d85a24a0907262dbf00d67c84b4" +content-hash = "0e3d06dd1ae8914ea98e3cd32c1e9747865b8d45e3a7aba7d8bed7e36943c3d1" diff --git a/pycytominer/cyto_utils/cells.py b/pycytominer/cyto_utils/cells.py index 49caf234..2d79ef0f 100644 --- a/pycytominer/cyto_utils/cells.py +++ b/pycytominer/cyto_utils/cells.py @@ -18,7 +18,7 @@ output, provide_linking_cols_feature_name_update, ) -from sqlalchemy import create_engine +from sqlalchemy import create_engine, text default_compartments = get_default_compartments() default_linking_cols = get_default_linking_cols() @@ -420,12 +420,12 @@ def get_subsample(self, df=None, compartment="cells", rename_col=True): def count_sql_table_rows(self, table): """Count total number of rows for a table.""" - (num_rows,) = next(self.conn.execute(f"SELECT COUNT(*) FROM {table}")) + (num_rows,) = next(self.conn.execute(text(f"SELECT COUNT(*) FROM {table}"))) return num_rows def get_sql_table_col_names(self, table): """Get column names from the database.""" - ptr = self.conn.execute(f"SELECT * FROM {table} LIMIT 1").cursor + ptr = self.conn.execute(text(f"SELECT * FROM {table} LIMIT 1")).cursor col_names = [obj[0] for obj in ptr.description] return col_names @@ -476,8 +476,7 @@ def load_compartment(self, compartment): # Query database for selected columns of chosen compartment columns = ", ".join(meta_cols + feat_cols) - query = f"select {columns} from {compartment}" - query_result = self.conn.execute(query) + query_result = self.conn.execute(text(f"select {columns} from {compartment}")) # Load data row by row for both meta information and features for i, row in enumerate(query_result): diff --git a/pyproject.toml b/pyproject.toml index 577b4e19..3607b8b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,7 @@ numpy = ">=1.16.5" scipy = ">=1.5" pandas = ">=1.2.0" scikit-learn = ">=0.21.2" -sqlalchemy = ">=1.3.6, <2" +sqlalchemy = ">=1.3.6,<3" pyarrow = ">=8.0.0" # Extra dependencies for cell_locations