FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-64662: Add virtual table support to sqlite3.Connection.iterdump by erlend-aasland · Pull Request #108340 · python/cpython · GitHub

Repository navigation

gh-64662: Add virtual table support to sqlite3.Connection.iterdump - #108340

Merged
erlend-aasland merged 9 commits into
python:mainfrom
erlend-aasland:sqlite/dumpiter
Aug 27, 2023
Merged

erlend-aasland merged 9 commits into
python:mainfrom
erlend-aasland:sqlite/dumpiter

Conversation

erlend-aasland commented Aug 22, 2023 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

erlend-aasland marked this pull request as ready for review August 23, 2023 10:56

Copy link
Copy Markdown
Contributor Author

@felixxm, would you like to review this? This is pretty much @palaviv's patch, adapted to main by me.

Copy link
Copy Markdown
Contributor Author

In businho/django-migrations-ci#38 (comment), @iurisilvio mentions that foreign key support must be disabled. ISTM that that aligns with the behaviour of the SQLite shell:

SQLite version 3.39.5 2022-10-14 20:58:05
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> PRAGMA foreign_keys=ON;
sqlite> create virtual table test using fts4(example);
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
PRAGMA writable_schema=ON;
INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql)VALUES('table','test','test',0,'CREATE VIRTUAL TABLE test using fts4(example)');
CREATE TABLE IF NOT EXISTS 'test_content'(docid INTEGER PRIMARY KEY, 'c0example');
CREATE TABLE IF NOT EXISTS 'test_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE IF NOT EXISTS 'test_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));
CREATE TABLE IF NOT EXISTS 'test_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
CREATE TABLE IF NOT EXISTS 'test_stat'(id INTEGER PRIMARY KEY, value BLOB);
PRAGMA writable_schema=OFF;
COMMIT;
sqlite> ^D

erlend-aasland commented Aug 23, 2023 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Further experiments show that PRAGMA foreign_keys=OFF; is prepended no matter if virtual tables are involved or not, so we should fix that separately IMO.

felixxm commented Aug 25, 2023

Copy link
Copy Markdown
Contributor

Maybe it's just me, but the number of different quotes in _iterdump() makes it hard for me to understand this code, check out #108472 (feel-free to reject it).

Comment thread Lib/sqlite3/dump.py Outdated
Comment thread Lib/sqlite3/dump.py Outdated
Comment thread Lib/sqlite3/dump.py Outdated
Comment thread Lib/sqlite3/dump.py Outdated
Comment thread Lib/sqlite3/dump.py Outdated
Comment thread Lib/sqlite3/dump.py Outdated

Copy link
Copy Markdown
Contributor Author

Thanks for the review, Mariusz!

erlend-aasland merged commit d0160c7 into python:main Aug 27, 2023

This comment was marked as outdated.

erlend-aasland deleted the sqlite/dumpiter branch August 27, 2023 22:18

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as off-topic.

This comment was marked as outdated.

erlend-aasland removed needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Aug 28, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request Aug 28, 2023
…n.iterdump (python#108340)

(cherry picked from commit d0160c7)

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>

Copy link
Copy Markdown

GH-108563 is a backport of this pull request to the 3.12 branch.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request Aug 28, 2023
…n.iterdump (python#108340)

(cherry picked from commit d0160c7)

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>

Copy link
Copy Markdown

GH-108564 is a backport of this pull request to the 3.11 branch.

This comment was marked as duplicate.

This comment was marked as duplicate.

erlend-aasland added a commit that referenced this pull request Aug 28, 2023
…dump (#108340) (#108564)

(cherry picked from commit d0160c7)

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>
Yhg1s pushed a commit that referenced this pull request Aug 28, 2023
…dump (#108340) (#108563)

* [3.12] gh-64662: Add virtual table support to sqlite3.Connection.iterdump (#108340)

(cherry picked from commit d0160c7)

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>

* The _quote_value helper is not part of 3.12; spell out the replacement

* With quotes

* Ok, let's use explicit quoting

---------

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL