github
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | pull_request | body | repo | type | active_lock_reason | performed_via_github_app | reactions | draft | state_reason |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1754174496 | I_kwDOCGYnMM5ojpQg | 558 | Ability to define unique columns when creating a table | 1910303 | open | 0 | 0 | 2023-06-13T06:56:19Z | 2023-08-18T01:06:03Z | NONE | When creating a new table, it would be good to have an option to set unique columns similar to how not_null is set. ```python from sqlite_utils import Database columns = {"mRID": str, "name": str} db = Database("example.db") db["ExampleTable"].create(columns, pk="mRID", not_null=["mRID"], if_not_exists=True) db["ExampleTable"].create_index(["mRID"], unique=True, if_not_exists=True) ``` So something like this would add the UNIQUE flag to the table definition. ```python db["ExampleTable"].create(columns, pk="mRID", not_null=["mRID"], unique=["mRID"], if_not_exists=True) ``` ```sql CREATE TABLE ExampleTable ( mRID TEXT PRIMARY KEY NOT NULL UNIQUE, name TEXT ); ``` | 140912432 | issue | { "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/558/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
||||||||
1817289521 | I_kwDOCGYnMM5sUaMx | 577 | Get `add_foreign_keys()` to work without modifying `sqlite_master` | 9599 | closed | 0 | 9 | 2023-07-23T20:40:18Z | 2023-08-18T17:43:11Z | 2023-08-18T00:48:10Z | OWNER | https://github.com/simonw/sqlite-utils/blob/13ebcc575d2547c45e8d31288b71a3242c16b886/sqlite_utils/db.py#L1165-L1174 This is the only place in the code that attempts to modify `sqlite_master` directly, which fails on some Python installations. Could this use the `.transform()` trick instead? Or automatically switch to that trick if it hits an error? | 140912432 | issue | { "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/577/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | ||||||
1855836914 | I_kwDOCGYnMM5undLy | 583 | Get rid of test.utils.collapse_whitespace | 9599 | closed | 0 | 1 | 2023-08-17T23:31:09Z | 2023-08-18T00:59:19Z | 2023-08-18T00:59:19Z | OWNER | I have a neater pattern for this now - instead of: https://github.com/simonw/sqlite-utils/blob/1dc6b5aa644a92d3654f7068110ed7930989ce71/tests/test_create.py#L472-L475 I now prefer: https://github.com/simonw/sqlite-utils/blob/1dc6b5aa644a92d3654f7068110ed7930989ce71/tests/test_create.py#L1163-L1171 | 140912432 | issue | { "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/583/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | ||||||
1855894222 | I_kwDOCGYnMM5unrLO | 585 | CLI equivalents to `transform(add_foreign_keys=)` | 9599 | closed | 0 | 7 | 2023-08-18T01:07:15Z | 2023-08-18T01:51:16Z | 2023-08-18T01:51:15Z | OWNER | The new options added in: - #577 Deserve consideration in the CLI as well. https://github.com/simonw/sqlite-utils/blob/d2bcdc00c6ecc01a6e8135e775ffdb87572b802b/sqlite_utils/db.py#L1706-L1708 | 140912432 | issue | { "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/585/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | ||||||
1856075668 | I_kwDOCGYnMM5uoXeU | 586 | .transform() fails to drop column if table is part of a view | 9599 | open | 0 | 3 | 2023-08-18T05:25:22Z | 2023-08-18T06:13:47Z | OWNER | I got this error trying to drop a column from a table that was part of a SQL view: > error in view plugins: no such table: main.pypi_releases Upon further investigation I found that this pattern seemed to fix it: ```python def transform_the_table(conn): # Run this in a transaction: with conn: # We have to read all the views first, because we need to drop and recreate them db = sqlite_utils.Database(conn) views = {v.name: v.schema for v in db.views if table.lower() in v.schema.lower()} for view in views.keys(): db[view].drop() db[table].transform( types=types, rename=rename, drop=drop, column_order=[p[0] for p in order_pairs], ) # Now recreate the views for name, schema in views.items(): db.create_view(name, schema) ``` So grab a copy of any view that might reference this table, start a transaction, drop those views, run the transform, recreate the views again. > I wonder if this should become an option in `sqlite-utils`? Maybe a `recreate_views=True` argument for `table.tranform(...)`? Should it be opt-in or opt-out? _Originally posted by @simonw in https://github.com/simonw/datasette-edit-schema/issues/35#issuecomment-1683370548_ | 140912432 | issue | { "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/586/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
||||||||
1854970601 | PR_kwDOBm6k_c5YKAZ4 | 2142 | Bump the python-packages group with 2 updates | 49699333 | closed | 0 | 2 | 2023-08-17T13:07:53Z | 2023-08-18T13:49:29Z | 2023-08-18T13:49:26Z | CONTRIBUTOR | simonw/datasette/pulls/2142 | Bumps the python-packages group with 2 updates: [sphinx](https://github.com/sphinx-doc/sphinx) and [blacken-docs](https://github.com/asottile/blacken-docs). Updates `sphinx` from 7.1.2 to 7.2.0 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/sphinx-doc/sphinx/releases">sphinx's releases</a>.</em></p> <blockquote> <h2>Sphinx 7.2.0</h2> <p>Changelog: <a href="https://www.sphinx-doc.org/en/master/changes.html">https://www.sphinx-doc.org/en/master/changes.html</a></p> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/sphinx-doc/sphinx/blob/master/CHANGES">sphinx's changelog</a>.</em></p> <blockquote> <h1>Release 7.2.0 (released Aug 17, 2023)</h1> <h2>Dependencies</h2> <ul> <li><a href="https://redirect.github.com/sphinx-doc/sphinx/issues/11511">#11511</a>: Drop Python 3.8 support.</li> <li><a href="https://redirect.github.com/sphinx-doc/sphinx/issues/11576">#11576</a>: Require Pygments 2.14 or later.</li> </ul> <h2>Deprecated</h2> <ul> <li><a href="https://redirect.github.com/sphinx-doc/sphinx/issues/11512">#11512</a>: Deprecate <code>sphinx.util.md5</code> and <code>sphinx.util.sha1</code>. Use <code>hashlib</code> instead.</li> <li><a href="https://redirect.github.com/sphinx-doc/sphinx/issues/11526">#11526</a>: Deprecate <code>sphinx.testing.path</code>. Use <code>os.path</code> or <code>pathlib</code> instead.</li> <li><a href="https://redirect.github.com/sphinx-doc/sphinx/issues/11528">#11528</a>: Deprecate <code>sphinx.util.split_index_msg</code> and <code>sphinx.util.split_into</code>. Use <code>sphinx.util.index_entries.split_index_msg</code> instead.</li> <li>Deprecate <code>sphinx.builders.html.Stylesheet</code> and <code>sphinx.builders.html.Javascript</code>. Use <code>sphinx.application.Sphinx.add_css_file()</code> and <code>sphinx.application.Sphinx.add_js_file()</code> instead.</li> <li><a href="https://redirect.github.com/sphinx-doc/sphinx/issues/11582">#11582</a>: Deprecate <code>sphinx.builders.h… | 107914493 | pull | { "url": "https://api.github.com/repos/simonw/datasette/issues/2142/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
0 | |||||
1855838223 | PR_kwDOCGYnMM5YM-I3 | 584 | .transform() instead of modifying sqlite_master for add_foreign_keys | 9599 | closed | 0 | 13 | 2023-08-17T23:32:45Z | 2023-08-18T00:48:13Z | 2023-08-18T00:48:08Z | OWNER | simonw/sqlite-utils/pulls/584 | Refs: - #577 <!-- readthedocs-preview sqlite-utils start --> ---- :books: Documentation preview :books:: https://sqlite-utils--584.org.readthedocs.build/en/584/ <!-- readthedocs-preview sqlite-utils end --> | 140912432 | pull | { "url": "https://api.github.com/repos/simonw/sqlite-utils/issues/584/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
0 |