@@ -1001,7 +1001,7 @@ def __change_rows(
10011001
10021002 sa_table = table_obj .get_oedb_table_proxy ()._main_table .get_sa_table ()
10031003
1004- pks = [c for c in sa_table .columns if c .primary_key ] # type:ignore
1004+ pks = [c for c in sa_table .columns if c .primary_key ] # type: ignore
10051005
10061006 inserts = []
10071007 cursor = load_cursor_from_context (context )
@@ -1333,11 +1333,11 @@ def add_type(d, type):
13331333 engine = _get_engine ()
13341334
13351335 artificial_connection = False
1336- connection : DBAPIConnection = engine .raw_connection () # type:ignore TODO
1336+ connection : DBAPIConnection = engine .raw_connection () # type: ignore TODO
13371337
13381338 if cursor is None :
13391339 artificial_connection = True
1340- cursor = cast (AbstractCursor , connection .cursor ()) # type:ignore TODO
1340+ cursor = cast (AbstractCursor , connection .cursor ()) # type: ignore TODO
13411341
13421342 try :
13431343 columns = list (describe_columns (table_obj ).keys ())
@@ -1545,7 +1545,7 @@ def set_table_metadata(table: str, metadata):
15451545 # ---------------------------------------
15461546
15471547 django_table_obj = Table .objects .get (name = table )
1548- django_table_obj .oemetadata = metadata_obj # type:ignore
1548+ django_table_obj .oemetadata = metadata_obj # type: ignore
15491549 django_table_obj .save ()
15501550
15511551 # ---------------------------------------
@@ -1570,8 +1570,7 @@ def get_single_table_size(table_obj: Table) -> dict | None:
15701570 Return size details for one table or None if not found.
15711571 """
15721572
1573- sql = text (
1574- """
1573+ sql = text ("""
15751574 SELECT
15761575 :schema AS table_schema,
15771576 :table AS table_name,
@@ -1581,8 +1580,7 @@ def get_single_table_size(table_obj: Table) -> dict | None:
15811580 pg_size_pretty(pg_relation_size(format('%I.%I', :schema, :table))) AS table_pretty,
15821581 pg_size_pretty(pg_indexes_size(format('%I.%I', :schema, :table))) AS index_pretty,
15831582 pg_size_pretty(pg_total_relation_size(format('%I.%I', :schema, :table))) AS total_pretty
1584- """ # noqa: E501
1585- )
1583+ """ ) # noqa: E501
15861584
15871585 sess = _create_oedb_session ()
15881586 try :
@@ -1605,8 +1603,7 @@ def list_table_sizes() -> list[dict]:
16051603 List table sizes
16061604 """
16071605 oedb_schema = SCHEMA_DATA
1608- sql = text (
1609- f"""
1606+ sql = text (f"""
16101607 SELECT
16111608 table_schema,
16121609 table_name,
@@ -1618,8 +1615,7 @@ def list_table_sizes() -> list[dict]:
16181615 WHERE table_schema='{ oedb_schema } '
16191616 AND table_type = 'BASE TABLE'
16201617 ORDER BY pg_total_relation_size(format('%I.%I', table_schema, table_name)) DESC
1621- """ # noqa: E501
1622- )
1618+ """ ) # noqa: E501
16231619
16241620 sess = _create_oedb_session ()
16251621 try :
@@ -1637,14 +1633,12 @@ def list_table_sizes() -> list[dict]:
16371633
16381634
16391635def table_has_row_with_id (table : Table , id : int | str , id_col : str = "id" ) -> bool :
1640- query = text (
1641- f"""
1636+ query = text (f"""
16421637 SELECT count(*)
16431638 FROM "{ table .oedb_schema } "."{ table .name } "
16441639 WHERE { id_col } = :id
16451640 ;
1646- """
1647- )
1641+ """ )
16481642
16491643 engine = _get_engine ()
16501644 with engine .connect () as conn :
@@ -1656,13 +1650,11 @@ def table_has_row_with_id(table: Table, id: int | str, id_col: str = "id") -> bo
16561650
16571651
16581652def table_get_row_count (table : Table ) -> int :
1659- query = text (
1660- f"""
1653+ query = text (f"""
16611654 SELECT count(*)
16621655 FROM "{ table .oedb_schema } "."{ table .name } "
16631656 ;
1664- """
1665- )
1657+ """ )
16661658
16671659 engine = _get_engine ()
16681660 with engine .connect () as conn :
@@ -1689,14 +1681,12 @@ def table_get_approx_row_count(table: Table, precise_below: int = 0) -> int:
16891681 # table name. but its validated by constraints
16901682 # on django table.name field
16911683
1692- query = text (
1693- f"""
1684+ query = text (f"""
16941685 SELECT reltuples::bigint AS approx_row_count
16951686 FROM pg_class
16961687 WHERE oid = '"{ table .oedb_schema } "."{ table .name } "'::regclass
16971688 ;
1698- """
1699- )
1689+ """ )
17001690
17011691 with engine .connect () as conn :
17021692 resp = _execute (conn , query )
@@ -2118,7 +2108,7 @@ def _execute(
21182108 * args ,
21192109 ** kwargs ,
21202110) -> ResultProxy :
2121- response = con .execute (sql , * args , ** kwargs ) # type:ignore
2111+ response = con .execute (sql , * args , ** kwargs ) # type: ignore
21222112 # Note: cast is only for type checking,
21232113 # should disappear once we migrate to sqlalchemy >= 1.4
21242114 response = cast (ResultProxy , response )
0 commit comments