mirror of
https://github.com/quay/quay.git
synced 2026-01-26 06:21:37 +03:00
Currently the CI breaks due to a dependency of black, `click`, breaking with it's latest release with `ImportError: cannot import name '_unicodefun' from 'click'`. Since black does not pin it's version of click it pulls in the latest version containing the breaking change and fails the CI check. This updates black with the patch. [See the original issue here.](https://github.com/psf/black/issues/2964) The rest of the changes are format updates introduced with the latest version of black.
12 lines
498 B
Python
12 lines
498 B
Python
def mysql_estimate_row_count(model_cls, db):
|
|
"""Uses the information_schema to retrieve the row count for a table."""
|
|
query = "SELECT table_rows FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = %s"
|
|
cursor = db.execute_sql(query, (model_cls._meta.table_name,))
|
|
res = cursor.fetchone()
|
|
return res[0]
|
|
|
|
|
|
def normal_row_count(model_cls, db):
|
|
"""Uses a normal .count() to retrieve the row count for a model."""
|
|
return model_cls.select().count()
|