Skip to content

Commit

Permalink
build(deps): bump sqlalchemy from 1.4.52 to 2.0.36; move to sqlalchem…
Browse files Browse the repository at this point in the history
…y.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] <support@github.com>

* use sqlalchemy.text for queries

* remove sqlalchemy uber warning

Co-Authored-By: Ken Brewer <kenibrewer@users.noreply.github.com>

* reupdate lockfile

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: d33bs <dave.bunten@cuanschutz.edu>
Co-authored-by: Ken Brewer <kenibrewer@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 4, 2024
1 parent 83956c1 commit 6a8bb47
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions pycytominer/cyto_utils/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a8bb47

Please sign in to comment.