Skip to content

Document that sqlite3.Cursor.executescript disregards isolation_level #74778

Description

@NoahLevitt
mannequin
BPO 30593
Nosy @berkerpeksag, @JimJJewett, @palaviv, @miss-islington, @erlend-aasland
PRs
  • bpo-30593: Document that sqlite3.Cursor.executescript disregards isolation_level #26220
  • [3.10] bpo-30593: Doc'ed that executescript() disregards isolation level (GH-26220) #26230
  • [3.9] bpo-30593: Doc'ed that executescript() disregards isolation level (GH-26220) #26231
  • Files
  • issue30593-fix.diff
  • issue30593-test.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-05-19.07:40:30.081>
    created_at = <Date 2017-06-07.22:26:12.665>
    labels = ['3.11', 'type-bug', '3.9', '3.10', 'docs']
    title = 'Document that sqlite3.Cursor.executescript disregards isolation_level'
    updated_at = <Date 2021-05-19.07:40:30.080>
    user = 'https://bugs.python.org/NoahLevitt'

    bugs.python.org fields:

    activity = <Date 2021-05-19.07:40:30.080>
    actor = 'berker.peksag'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-05-19.07:40:30.081>
    closer = 'berker.peksag'
    components = ['Documentation']
    creation = <Date 2017-06-07.22:26:12.665>
    creator = 'Noah Levitt'
    dependencies = []
    files = ['46942', '46943']
    hgrepos = []
    issue_num = 30593
    keywords = ['patch']
    message_count = 7.0
    messages = ['295376', '295567', '295813', '295815', '393908', '393928', '393929']
    nosy_count = 7.0
    nosy_names = ['docs@python', 'berker.peksag', 'Jim.Jewett', 'palaviv', 'Noah Levitt', 'miss-islington', 'erlendaasland']
    pr_nums = ['26220', '26230', '26231']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30593'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. NoahLevitt commented on Jun 7, 2017

      NoahLevittmannequin
      MannequinAuthor

      As far as I can tell, sqlite3 executescript() does not respect isolation_level. Is that true? If so, I think it's worth mentioning in the doc. Or maybe it should respect isolation_level, not sure there's any particular reason not to.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Jun 7, 2017
    3. jimjjewett commented on Jun 9, 2017

      jimjjewettmannequin
      Mannequin

      Do you have a test case that could be used to verify a patch?
      (Or even a full patch?)

    4. NoahLevitt commented on Jun 12, 2017

      NoahLevittmannequin
      MannequinAuthor

      Here's a test case

    5. NoahLevitt commented on Jun 12, 2017

      NoahLevittmannequin
      MannequinAuthor

      And here's a fix.

      Unfortunately I think the change could break people's scripts. If they have isolation_level set (not None) and use executescript(), they will have to issue an explicit call to connection.commit().

      executescript() could do the commit itself explicitly after running the sql, I suppose. Then the behavior is much like the old behavior, but at least you get the performance boost of running inside a transaction. (Substantial if you pass 10k insert statements to executescript(), or something like that.)

      Or, we could not change the code, and instead change the documentation. The docs could suggest wrapping the sql script with "begin;" and "commit;".

    6. erlend-aasland commented on May 18, 2021

      @erlend-aasland
      Contributor

      Mentioning this behaviour in the documentation should be sufficient.

    7. added
      docsDocumentation in the Doc dir
      3.11only security fixes
      and removed
      stdlibStandard Library Python modules in the Lib/ directory
      on May 18, 2021
    8. changed the title [-]sqlite3 executescript does not respect isolation_level?[/-] [+]Document that sqlite3.Cursor.executescript disregards isolation_level[/+] on May 18, 2021
    9. berkerpeksag commented on May 19, 2021

      @berkerpeksag
      Member

      New changeset 76ed53c by Miss Islington (bot) in branch '3.9':
      bpo-30593: Doc'ed that executescript() disregards isolation level (GH-26220)
      76ed53c

    10. berkerpeksag commented on May 19, 2021

      @berkerpeksag
      Member

      New changeset 1f483c0 by Miss Islington (bot) in branch '3.10':
      bpo-30593: Doc'ed that executescript() disregards isolation level (GH-26220)
      1f483c0

    11. transferred this issue fromon Apr 10, 2022
    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.10 (EOL)end of life3.11only security fixes3.9 (EOL)end of lifedocsDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions