Skip to content

Commit

Permalink
[QOLDEV-905] clean up type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrawnCA committed Oct 24, 2024
1 parent df65577 commit bf20774
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ckanext/datastore/backend/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,7 @@ def resource_fields(self, id: str) -> dict[str, Any]:
conn.execute(_LOCK_TIMEOUT_SQL)
tabletype_results = conn.execute(tabletype_sql)
info['meta']['table_type'] = \
tabletype_results.fetchone()[0] # type: ignore
tabletype_results.fetchone()[0]
# MATERIALIZED VIEWS show as BASE TABLE, so
# we check pg_matviews
matview_sql = sa.text(u'''
Expand All @@ -2145,7 +2145,7 @@ def resource_fields(self, id: str) -> dict[str, Any]:
with engine.connect() as conn:
conn.execute(_LOCK_TIMEOUT_SQL)
matview_results = conn.execute(matview_sql)
if matview_results.fetchone()[0]: # type: ignore
if matview_results.fetchone()[0]:
info['meta']['table_type'] = 'MATERIALIZED VIEW'

# SIZE - size of table in bytes
Expand All @@ -2154,7 +2154,7 @@ def resource_fields(self, id: str) -> dict[str, Any]:
with engine.connect() as conn:
conn.execute(_LOCK_TIMEOUT_SQL)
size_results = conn.execute(size_sql)
info['meta']['size'] = size_results.fetchone()[0] # type: ignore
info['meta']['size'] = size_results.fetchone()[0]

# DB_SIZE - size of database in bytes
dbsize_sql = sa.text(
Expand All @@ -2163,7 +2163,7 @@ def resource_fields(self, id: str) -> dict[str, Any]:
conn.execute(_LOCK_TIMEOUT_SQL)
dbsize_results = conn.execute(dbsize_sql)
info['meta']['db_size'] = \
dbsize_results.fetchone()[0] # type: ignore
dbsize_results.fetchone()[0]

# IDXSIZE - size of all indices for table in bytes
idxsize_sql = sa.text(
Expand All @@ -2172,7 +2172,7 @@ def resource_fields(self, id: str) -> dict[str, Any]:
conn.execute(_LOCK_TIMEOUT_SQL)
idxsize_results = conn.execute(idxsize_sql)
info['meta']['idx_size'] = \
idxsize_results.fetchone()[0] # type: ignore
idxsize_results.fetchone()[0]

# all the aliases for this resource
alias_sql = sa.text(u'''
Expand Down Expand Up @@ -2241,7 +2241,7 @@ def resource_fields(self, id: str) -> dict[str, Any]:
pass
return info

def get_all_ids(self):
def get_all_ids(self) -> list[str]:
resources_sql = sa.text(
u'''SELECT name FROM "_table_metadata"
WHERE alias_of IS NULL''')
Expand Down

0 comments on commit bf20774

Please sign in to comment.