issue_comments: 846592392
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/615#issuecomment-846592392 | https://api.github.com/repos/simonw/datasette/issues/615 | 846592392 | MDEyOklzc3VlQ29tbWVudDg0NjU5MjM5Mg== | 9599 | 2021-05-23T16:49:30Z | 2021-05-23T16:49:44Z | OWNER | I started looking at this again, inspired by #1326. I have a new diff that works against the latest ```diff diff --git a/datasette/views/table.py b/datasette/views/table.py index 4879228..f4b2ee2 100644 --- a/datasette/views/table.py +++ b/datasette/views/table.py @@ -64,6 +64,36 @@ class Row: class RowTableShared(DataView): + async def columns_to_select(self, db, table, request): + table_columns = await db.table_columns(table) + if "_col" in request.args and "_nocol" in request.args: + raise DatasetteError("Cannot use _col and _nocol at the same time") + if "_col" in request.args: + new_columns = [] + for column in request.args.getlist("_col"): + if column not in table_columns: + raise DatasetteError("_col={} is an invalid column".format(column)) + new_columns.append(column) + return new_columns + elif "_nocol" in request.args: + # Return all columns EXCEPT these + bad_columns = [ + column + for column in request.args.getlist("_nocol") + if column not in table_columns + ] + if bad_columns: + raise DatasetteError( + "_nocol={} - invalid columns".format(", ".join(bad_columns)) + ) + return [ + column + for column in table_columns + if column not in request.args.getlist("_nocol") + ] + else: + return table_columns + async def sortable_columns_for_table(self, database, table, use_rowid): db = self.ds.databases[database] table_metadata = self.ds.table_metadata(database, table) @@ -321,18 +351,16 @@ class TableView(RowTableShared): )
@@ -715,6 +743,8 @@ class TableView(RowTableShared): column = fk["column"] if column not in columns_to_expand: continue + if column not in columns: + continue expanded_columns.append(column) # Gather the values column_index = columns.index(column) ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
517451234 |