issue_comments: 897588624
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/sqlite-utils/issues/186#issuecomment-897588624 | https://api.github.com/repos/simonw/sqlite-utils/issues/186 | 897588624 | IC_kwDOCGYnMM41gB2Q | 9308268 | 2021-08-12T12:13:25Z | 2021-08-12T12:13:25Z | NONE | I think I ran into an issue that's perhaps related with I have a case where I want to create a lookup table for all the related title data where there are possibly multiple null values in the related columns .... ```python3 sql = """\ INSERT INTO "circulation_info" ("item_id", "bib_title", "bib_creator", "bib_format", "bib_pub_year", "checkout_date") VALUES (1, "title one", "creator one", "Book", 2018, "2021-08-12 00:01"), (2, "title two", "creator one", "Book", 2019, "2021-08-12 00:02"), (3, "title three", NULL, "DVD", 2020, "2021-08-12 00:03"), (4, "title four", NULL, "DVD", NULL, "2021-08-12 00:04"), (5, "title five", NULL, "DVD", NULL, "2021-08-12 00:05") """ with sqlite3.connect('test_bib.db') as con: con.execute(sql) ``` when I run the ```python3
db["circulation_info"].extract(
[
"bib_title",
"bib_creator",
"bib_format" db = sqlite_utils.Database("test_bib.db") for row in db["circulation_info"].rows: print(row) print("\n---\n") for row in db["bib_info"].rows: print(row) ``` results in this .. ``` {'id': 1, 'item_id': 1, 'bib_info_id': 1, 'bib_pub_year': 2018, 'checkout_date': '2021-08-12 00:01'} {'id': 2, 'item_id': 2, 'bib_info_id': 2, 'bib_pub_year': 2019, 'checkout_date': '2021-08-12 00:02'} {'id': 3, 'item_id': 3, 'bib_info_id': None, 'bib_pub_year': 2020, 'checkout_date': '2021-08-12 00:03'} {'id': 4, 'item_id': 4, 'bib_info_id': None, 'bib_pub_year': None, 'checkout_date': '2021-08-12 00:04'} {'id': 5, 'item_id': 5, 'bib_info_id': None, 'bib_pub_year': None, 'checkout_date': '2021-08-12 00:05'} {'id': 1, 'bib_title': 'title one', 'bib_creator': 'creator one', 'bib_format': 'Book'} {'id': 2, 'bib_title': 'title two', 'bib_creator': 'creator one', 'bib_format': 'Book'} {'id': 3, 'bib_title': 'title three', 'bib_creator': None, 'bib_format': 'DVD'} {'id': 4, 'bib_title': 'title four', 'bib_creator': None, 'bib_format': 'DVD'} {'id': 5, 'bib_title': 'title five', 'bib_creator': None, 'bib_format': 'DVD'} ``` Seems like it's correctly generating the row data for those lookups, but it's not correctly updating the foreign key back to the primary table? Looks like it just results in a Any ideas on why? Thanks again! |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
722816436 |