Skip to content

Conversation

@itssme
Copy link
Contributor

@itssme itssme commented Sep 28, 2018

The iterdump command in Lib/sqlite3/dump.py assumed that the table "sqlite_sequence" already exists. When this was not the case and exception was thrown.

Changes:

  • Sqlite3 iterdump now deletes and recreates the "sqlite_sequence" table at the end of the transaction (Just like the sqlite3 command ".dump" does)
  • Added two new test for the iterdump command

Resolves gh-79009

…ement

The iterdump command in Lib/sqlite3/dump.py assumed that the table "sqlite_sequence" already exists. When this was not the case and exception was thrown.
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@j0hax
Copy link

j0hax commented Jun 24, 2021

Hello, it seems that I stumbled upon this bug today with Python 3.6.13. Are there any news as to a fix?

@itssme
Copy link
Contributor Author

itssme commented Jun 24, 2021

I saw that recently the unit tests of sqlite3 Lib/sqlite3/test/dump.py were changed, 849e339#diff-641ffce15acf9f552596b6192c714f53590980dba32625057918b53a9676f9ae
I will update my PR soon.

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Jun 24, 2021

I saw that recently the unit tests of sqlite3 Lib/sqlite3/test/dump.py were changed, 849e339#diff-641ffce15acf9f552596b6192c714f53590980dba32625057918b53a9676f9ae
I will update my PR soon.

Thanks! Please also sign the CLA before we can do a review.

https://devguide.python.org/pullrequest/

@itssme itssme requested a review from berkerpeksag as a code owner July 3, 2021 18:38
@itssme
Copy link
Contributor Author

itssme commented Jul 22, 2021

I will make the requested changes as soon as I am home from my holidays 👍. Right now the internet is so slow, I cannot clone the project

@itssme itssme requested a review from erlend-aasland October 17, 2021 13:54
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating your PR :) I've left some comments.

@erlend-aasland
Copy link
Contributor

@itssme, do you plan to follow up this PR?

@itssme
Copy link
Contributor Author

itssme commented May 20, 2022

Thanks for the reminder, yes I will update it this weekend 👍

@ghost
Copy link

ghost commented May 22, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@erlend-aasland
Copy link
Contributor

@itssme, I won't have time to look at this for a week or two, but it is on my list :)

@erlend-aasland erlend-aasland changed the title bpo-34828 sqlite3.iterdump now correctly handles tables with autoincrement gh-79009: sqlite3.iterdump now correctly handles tables with autoincrement Jun 9, 2022
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

I think the tests can be simplified; the posts table is not really needed to test this functionality, so I suggest to drop it, in order to narrow down the tests.

In test_dump_autoincrement_create_new_db, one test table should be sufficient, right?

I also got some style nits; do you mind if I just apply them before merge?

…xed wrong use of double quotes and single quotes in sqlite3 statements
@itssme
Copy link
Contributor Author

itssme commented Jun 17, 2022

I removed the posts table, renamed the tags table to t1 and simplified it. These were the tables from the database, where I first discovered the issue.

@itssme
Copy link
Contributor Author

itssme commented Jun 18, 2022

I also got some style nits; do you mind if I just apply them before merge?

Yes please, feel free to make any changes 👍

@erlend-aasland
Copy link
Contributor

Thanks! I'll review the changes this coming week.

- consolidate construction of sqlite_sequence
- use existing quoting style
- reduce number of escape chars in string literals
- normalise variable names
- in test_dump_autoincrement_create_new_db, simplify setup
- use subTest in order to make it easier to assert more thoroughly
@erlend-aasland erlend-aasland added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Jun 19, 2022
@miss-islington
Copy link
Contributor

Thanks @itssme for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jun 19, 2022
@bedevere-bot
Copy link

GH-94015 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jun 19, 2022
@erlend-aasland
Copy link
Contributor

Thank you so much for the report, the fix, and your patience, @itssme! Unfortunately this took way too long to land, but at last the fix is on its way to the upcoming Python 3.12, 3.11, and 3.10 releases.

Thanks again!

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.

sqlite.iterdump does not work for (most) databases with autoincrement

6 participants