Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-95273: Move sqlite3 executemany examples from reference to tutorial #95351

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jul 27, 2022

@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Jul 27, 2022

My 2 cents:

The executemany examples are way more complex than the average user needs. We should focus on the sqlite3 module; not on writing fancy iterators.

The only thing that bothers me, is that we do not explicitly mention that the cursor can be used as an iterator. We could add a mention in the cursor class description.

Copy link
Member

@CAM-Gerlach CAM-Gerlach left a comment

A couple minor comments, otherwise LGTM. Thanks @erlend-aasland !

Doc/library/sqlite3.rst Outdated Show resolved Hide resolved
Doc/library/sqlite3.rst Outdated Show resolved Hide resolved
erlend-aasland and others added 2 commits Jul 28, 2022
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Jul 28, 2022

The only thing that bothers me, is that we do not explicitly mention that the cursor can be used as an iterator. We could add a mention in the cursor class description.

I've already got this covered in the #95273 todo list. UPDATE: PR => #95379

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jul 28, 2022

I've got quite a lot on at the moment, so I'll leave this one in @CAM-Gerlach's very capable hands, if that's okay!

@AlexWaygood AlexWaygood removed their request for review Jul 28, 2022
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Jul 28, 2022

I wonder if it may make sense to keep a minimum example in the reference, though. The two previous examples ate more than a screenful. How about leaving something like this:

data = [
    ("row1",),
    ("row2",),
]
cur.executemany("insert into t values(?)", data)

@CAM-Gerlach
Copy link
Member

@CAM-Gerlach CAM-Gerlach commented Jul 29, 2022

How about leaving something like this:

SGTM; concise examples can certainly be helpful to aiding understanding and this one certainly helps me understand the purpose of executemany much better (at least as a relative novice)

Copy link
Member

@CAM-Gerlach CAM-Gerlach left a comment

LGTM, thanks @erlend-aasland 👍

@erlend-aasland erlend-aasland merged commit f0bf795 into python:main Jul 29, 2022
14 checks passed
@erlend-aasland erlend-aasland deleted the sqlite-reference/extract-executemany-example branch Jul 29, 2022
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 29, 2022

Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒🤖

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 29, 2022

Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 29, 2022
…utorial (pythonGH-95351)

(cherry picked from commit f0bf795)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jul 29, 2022

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

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 29, 2022
…utorial (pythonGH-95351)

(cherry picked from commit f0bf795)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jul 29, 2022

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

miss-islington added a commit that referenced this issue Jul 29, 2022
GH-95351)

(cherry picked from commit f0bf795)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
miss-islington added a commit that referenced this issue Jul 29, 2022
GH-95351)

(cherry picked from commit f0bf795)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
@erlend-aasland erlend-aasland linked an issue Aug 1, 2022 that may be closed by this pull request
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants