Revert "Support for generated columns, closes #1116" - it failed CI

This reverts commit 37f87b5e52.
This commit is contained in:
Simon Willison 2020-11-30 12:09:22 -08:00
commit dea3c508b3
3 changed files with 8 additions and 76 deletions

View file

@ -64,7 +64,7 @@ HASH_LENGTH = 7
# Can replace this with Column from sqlite_utils when I add that dependency
Column = namedtuple(
"Column", ("cid", "name", "type", "notnull", "default_value", "is_pk", "hidden")
"Column", ("cid", "name", "type", "notnull", "default_value", "is_pk")
)
@ -460,11 +460,11 @@ def detect_primary_keys(conn, table):
" Figure out primary keys for a table. "
table_info_rows = [
row
for row in conn.execute(f'PRAGMA table_xinfo("{table}")').fetchall()
if row["pk"]
for row in conn.execute(f'PRAGMA table_info("{table}")').fetchall()
if row[-1]
]
table_info_rows.sort(key=lambda row: row["pk"])
return [str(r["name"]) for r in table_info_rows]
table_info_rows.sort(key=lambda row: row[-1])
return [str(r[1]) for r in table_info_rows]
def get_outbound_foreign_keys(conn, table):
@ -572,7 +572,7 @@ def table_columns(conn, table):
def table_column_details(conn, table):
return [
Column(*r)
for r in conn.execute(f"PRAGMA table_xinfo({escape_sqlite(table)});").fetchall()
for r in conn.execute(f"PRAGMA table_info({escape_sqlite(table)});").fetchall()
]