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 — Align sqlite3.Connection.iterdump with the .dump() command of the SQLite shell · Issue #108364 · python/cpython

Align sqlite3.Connection.iterdump with the .dump() command of the SQLite shell #108364

New issue
Copy link
New issue
Copy link
Closed
Closed
Align sqlite3.Connection.iterdump with the .dump() command of the SQLite shell#108364
Copy link
Labels
3.13only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-sqlite3type-featureA feature request or enhancementA feature request or enhancement

Description

@erlend-aasland
erlend-aasland
opened on Aug 23, 2023
Issue body actions

The iterdump docs promise the following:

Return an iterator to dump the database as SQL source code.

The current implementation has several drawbacks compared to the SQLite shell .dump command. We should try to align our implementation with the .dump command of the SQLite shell.

See also #64662

Linked PRs

  • gh-108364: In sqlite3, disable foreign keys before dumping SQL schema #108471
  • gh-108364: Simplify quoting values and identifiers in sqlite3's iterdump() #108472
  • gh-108364: In sqlite3, disable foreign keys before dumping SQL schema #113957

Activity

  1. erlend-aasland
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    3.13only security fixesonly security fixes
    on Aug 23, 2023
  2. erlend-aasland
    added this to sqlite3 issueson Aug 23, 2023
  3. erlend-aasland
    moved this to TODO: Bugs in sqlite3 issueson Aug 23, 2023
  4. erlend-aasland commented on Aug 25, 2023

    @erlend-aasland
    erlend-aasland
    on Aug 25, 2023
    ContributorAuthor
    More actions

    The SQLite shell always starts the dump by disabling foreign key support. It has been doing so for a long time:

    $ ~/install/sqlite-3.42.0/bin/sqlite3
    SQLite version 3.42.0 2023-05-16 12:36:15
    Enter ".help" for usage hints.
    Connected to a transient in-memory database.
    Use ".open FILENAME" to reopen on a persistent database.
    sqlite> .dump
    PRAGMA foreign_keys=OFF;
    BEGIN TRANSACTION;
    COMMIT;
    sqlite> ^D
    $ ~/install/sqlite-3.7.15/bin/sqlite3
    SQLite version 3.7.15 2012-12-12 13:36:53
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite> .dump
    PRAGMA foreign_keys=OFF;
    BEGIN TRANSACTION;
    COMMIT;
    sqlite> ^D

    I suggest we align to this practise.

    In SQLite foreign key support is always disabled by default; one has to explicitly enable it, if needed.

  5. erlend-aasland
    added a commit that references this issue on Aug 25, 2023

    pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …

    9f43f34
  6. erlend-aasland
    moved this from TODO: Bugs to In Progress in sqlite3 issueson Aug 25, 2023
  7. erlend-aasland
    added
    type-featureA feature request or enhancementA feature request or enhancement
    and removed
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 25, 2023
  8. erlend-aasland commented on Aug 25, 2023

    @erlend-aasland
    erlend-aasland
    on Aug 25, 2023
    ContributorAuthor
    More actions

    I restyled this as a feature, not a bugfix.

  9. felixxm
    added a commit that references this issue on Aug 25, 2023

    pythongh-108364: Simplify quoting values/identifiers in sqlite3.dump.…

    2423154
  10. erlend-aasland
    added a commit that references this issue on Aug 25, 2023

    gh-108364: Simplify quoting values and identifiers in sqlite3's iterd…

    75903f2
  11. erlend-aasland
    added
    topic-sqlite3
    on Aug 29, 2023
  12. erlend-aasland commented on Aug 29, 2023

    @erlend-aasland
    erlend-aasland
    on Aug 29, 2023
    ContributorAuthor
    More actions

    cc. @EddInSverige

  13. erlend-aasland commented on Aug 30, 2023

    @erlend-aasland
    erlend-aasland
    on Aug 30, 2023
    ContributorAuthor
    More actions

    FTR, here's the SQLite shell C code:

    https://sqlite.org/src/file?name=src/shell.c.in&ci=trunk

    Reacted by Corvin McPherson
  14. iritkatriel
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Nov 27, 2023
  15. felixxm
    added 2 commits that reference this issue on Jan 11, 2024

    pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …

    d409375

    pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …

    6d67747
  16. erlend-aasland
    added a commit that references this issue on Jan 12, 2024

    gh-108364: In sqlite3, disable foreign keys before dumping SQL schema (…

    de777e4
  17. erlend-aasland commented on Jan 12, 2024

    @erlend-aasland
    erlend-aasland
    on Jan 12, 2024
    ContributorAuthor
    More actions

    I'm closing this issue, since it has no more actionable items; instead, we can open better targeted issues for specific .dump features we would like to add to .iterdump().

  18. erlend-aasland
    closed this as completedon Jan 12, 2024
  19. github-project-automation
    moved this from In Progress to Done in sqlite3 issueson Jan 12, 2024
  20. kulikjak
    added a commit that references this issue on Jan 22, 2024

    pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …

    577a6b6
  21. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …

    15549f3
  22. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-108364: In sqlite3, disable foreign keys before dumping SQL …

    f3bfaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-sqlite3type-featureA feature request or enhancementA feature request or enhancement

    Projects

    • sqlite3 issues
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.