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/24#issuecomment-501572149,https://api.github.com/repos/simonw/sqlite-utils/issues/24,501572149,MDEyOklzc3VlQ29tbWVudDUwMTU3MjE0OQ==,9599,2019-06-13T06:47:17Z,2019-06-13T06:47:17Z,OWNER,"@IgnoredAmbience this is now shipped in sqlite-utils 1.2 - documentation here: * https://sqlite-utils.readthedocs.io/en/latest/python-api.html#python-api-defaults-not-null * https://sqlite-utils.readthedocs.io/en/latest/cli.html#cli-defaults-not-null","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449818897, https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501516028,https://api.github.com/repos/simonw/sqlite-utils/issues/24,501516028,MDEyOklzc3VlQ29tbWVudDUwMTUxNjAyOA==,9599,2019-06-13T01:42:36Z,2019-06-13T01:42:36Z,OWNER,"Maybe it's time to create a `sqlite-utils create-table` command here too, rather than forcing people to create tables only by inserting example data.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449818897, https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501515609,https://api.github.com/repos/simonw/sqlite-utils/issues/24,501515609,MDEyOklzc3VlQ29tbWVudDUwMTUxNTYwOQ==,9599,2019-06-13T01:40:12Z,2019-06-13T01:40:47Z,OWNER,"But what to do for creating a table? For the Python function I could do this: ```python db[""cats""].create({ ""id"": int, ""name"": str, ""score"": int, ""weight"": float, }, pk=""id"", not_null={""weight""}, defaults={""score"": 1}) ``` The CLI tool only every creates tables as a side-effect of a `sqlite-utils insert` or `sqlite-utils upsert`. I can have them accept optional arguments, `--not-null colname` and `--default colname value`: ``` echo '{""name"": ""Cleo"", ""age"": 4, ""score"": 2}' | \ sqlite-utils insert dogs.db dogs - \ --not-null age \ --not-null name \ --default score 1 ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449818897, https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501514575,https://api.github.com/repos/simonw/sqlite-utils/issues/24,501514575,MDEyOklzc3VlQ29tbWVudDUwMTUxNDU3NQ==,9599,2019-06-13T01:34:55Z,2019-06-13T01:34:55Z,OWNER,"Since you can't have one without the other, I'm going with `--not-null-default=` and `not_null_default=` for the add column versions of this.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449818897, https://github.com/simonw/sqlite-utils/issues/24#issuecomment-501509642,https://api.github.com/repos/simonw/sqlite-utils/issues/24,501509642,MDEyOklzc3VlQ29tbWVudDUwMTUwOTY0Mg==,9599,2019-06-13T01:06:09Z,2019-06-13T01:06:09Z,OWNER,"Hmm... we need the ability to pass `--not-null` when we are creating a table as well. If you attempt to add `NOT NULL` to a column after a table has first been created you get this error: ```sqlite3.OperationalError: Cannot add a NOT NULL column with default value NULL```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449818897, https://github.com/simonw/sqlite-utils/issues/24#issuecomment-499603495,https://api.github.com/repos/simonw/sqlite-utils/issues/24,499603495,MDEyOklzc3VlQ29tbWVudDQ5OTYwMzQ5NQ==,9599,2019-06-06T18:02:20Z,2019-06-06T18:02:20Z,OWNER,"This seems reasonable. It could look like this: ```python db[""dogs""].add_column(""instagram"", str, not_null=True) db[""dogs""].add_column(""is_good_dog"", bool, default=True) ``` And this: ```bash $ sqlite-utils add-column mydb.db dogs instagram --not-null $ sqlite-utils add-column mydb.db dogs is_good_dog integer --default=1 ``` ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",449818897,