GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-64662: Add virtual table support to sqlite3.Connection.iterdump by erlend-aasland · Pull Request #108340 · python/cpython

Conversation

@erlend-aasland

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: sqlite dumpiter dumps invalid script when virtual tables are used #64662

📚 Documentation preview 📚: https://cpython-previews--108340.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@palaviv @erlend-aasland
pythongh-64662: Add virtual table support to sqlite3.Connection.iterdump
8381c49
@erlend-aasland erlend-aasland added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Aug 22, 2023
@bedevere-bot bedevere-bot mentioned this pull request Aug 22, 2023
sqlite dumpiter dumps invalid script when virtual tables are used #64662
Closed
erlend-aasland added 2 commits August 22, 2023 22:33
@erlend-aasland
Remove old-style line continuation
12d126f
@erlend-aasland
Merge branch 'main' into sqlite/dumpiter
650b0df
@erlend-aasland
erlend-aasland marked this pull request as ready for review August 23, 2023 10:56
@erlend-aasland
erlend-aasland requested a review from berkerpeksag as a code owner August 23, 2023 10:56
@bedevere-bot bedevere-bot added the awaiting core review label Aug 23, 2023
@erlend-aasland

erlend-aasland commented Aug 23, 2023

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.

felixxm reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 23, 2023

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 23, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@felixxm felixxm mentioned this pull request Aug 25, 2023
gh-108364: Simplify quoting values and identifiers in sqlite3's iterdump() #108472
Merged
@felixxm

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).

erlend-aasland reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Merge branch 'main' into sqlite/dumpiter
92e0303
erlend-aasland
erlend-aasland commented Aug 25, 2023
View reviewed changes
Comment thread Lib/sqlite3/dump.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland commented Aug 25, 2023
View reviewed changes
Comment thread Lib/sqlite3/dump.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Use new quoting helpers
9741df5
erlend-aasland
erlend-aasland commented Aug 25, 2023
View reviewed changes
Comment thread Lib/sqlite3/dump.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Style
3af3b18
erlend-aasland
erlend-aasland commented Aug 25, 2023
View reviewed changes
Comment thread Lib/sqlite3/dump.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Remove temp variable
e11bff8
erlend-aasland
erlend-aasland commented Aug 25, 2023
View reviewed changes
Comment thread Lib/sqlite3/dump.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Quoting
62b2ef1
erlend-aasland
erlend-aasland commented Aug 25, 2023
View reviewed changes
Comment thread Lib/sqlite3/dump.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Not the int literal!
e30c14a
felixxm
felixxm approved these changes Aug 25, 2023
View reviewed changes
@erlend-aasland

erlend-aasland commented Aug 27, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for the review, Mariusz!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

This comment was marked as outdated.

Sign in to view
@bedevere-bot bedevere-bot removed the awaiting core review label Aug 27, 2023
@erlend-aasland
erlend-aasland deleted the sqlite/dumpiter branch August 27, 2023 22:18
@miss-islington

This comment was marked as outdated.

Sign in to view
@miss-islington miss-islington assigned erlend-aasland Aug 27, 2023
@miss-islington

This comment was marked as outdated.

Sign in to view
@bedevere-bot

This comment was marked as off-topic.

Sign in to view
@erlend-aasland

This comment was marked as outdated.

Sign in to view
@erlend-aasland 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
@erlend-aasland @palaviv
[3.12] pythongh-64662: Add virtual table support to sqlite3.Connectio…
d5ad25e
…n.iterdump (python#108340)

(cherry picked from commit d0160c7)

Co-authored-by: Aviv Palivoda <[email protected]>
@bedevere-bot

bedevere-bot commented Aug 28, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request Aug 28, 2023
@erlend-aasland @palaviv
[3.11] pythongh-64662: Add virtual table support to sqlite3.Connectio…
cd0cd13
…n.iterdump (python#108340)

(cherry picked from commit d0160c7)

Co-authored-by: Aviv Palivoda <[email protected]>
@bedevere-bot

bedevere-bot commented Aug 28, 2023

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

This comment was marked as duplicate.

Sign in to view
@bedevere-bot

This comment was marked as duplicate.

Sign in to view
erlend-aasland added a commit that referenced this pull request Aug 28, 2023
@erlend-aasland @palaviv
[3.11] gh-64662: Fix virtual table support in sqlite3.Connection.iter…
33eee43
…dump (#108340) (#108564)

(cherry picked from commit d0160c7)

Co-authored-by: Aviv Palivoda <[email protected]>
Yhg1s pushed a commit that referenced this pull request Aug 28, 2023
@erlend-aasland @palaviv
[3.12] gh-64662: Fix virtual table support in sqlite3.Connection.iter…
b451e90
…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 <[email protected]>

* 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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag
1 more reviewer
@felixxm felixxm felixxm approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@erlend-aasland erlend-aasland

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@erlend-aasland @felixxm @miss-islington @bedevere-bot @palaviv
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.