Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-96168: Add sqlite3 row factory how-to#99507

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@erlend-aasland
Copy link
Contributor

@erlend-aaslanderlend-aasland commentedNov 15, 2022
edited by bedevere-bot
Loading

@erlend-aaslanderlend-aaslandforce-pushed thesqlite-docs/row-factory-how-to branch fromdc774c6 toe985babCompareNovember 15, 2022 11:49
Copy link
Member

@CAM-GerlachCAM-Gerlach left a comment

Choose a reason for hiding this comment

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

Thanks@erlend-aasland .

Overall, I found the examples helpful, and a good balance between concise and detailed. However, maybe this is just me, but to me the section did appear pretty heavy on examples, but without as much explicit focus on solving specific user problems, as would be appropriate for a how-to. In that sense, it almost feels more like a tutorial, having readers learn using row factories by example, as opposed to telling them how to solve specific problems using row factories.

@ezio-melotti , what do you think?

@erlend-aasland
Copy link
ContributorAuthor

However, maybe this is just me, but to me the section did appear pretty heavy on examples, but without as much explicit focus on solving specific user problems, as would be appropriate for a how-to.

Yeah, maybe... but How To's are recipes. How can I create a foo row factory? How do I use a bar row factory? How do I use the sqlite3.Row row factory? I don't think it matters much that it is example heavy. IMO it is too thin for a tutorial, and definitely too thin for an explanation.

merwok reacted with thumbs up emoji

@erlend-aasland
Copy link
ContributorAuthor

erlend-aasland commentedNov 16, 2022
edited
Loading

Ouch, it just occurred to me that the Cursor also has arow_factory attribute, with the following problems:

  • it is not documented (easily fixed;we can do that in this PR done in this PR)
  • it iscopied from the connection inCursor.__init__, so changing the connection row factory does not affect the row factories of the cursors belonging to that connection; vice versa

So, more prose coming up.

>>>importsqlite3>>>cx=sqlite3.connect(":memory:")>>>cx.row_factory=sqlite3.Row>>>cu=cx.cursor()>>>cx.row_factory=None>>>cu.row_factory==cx.row_factoryFalse>>>cu.connection.row_factory==cx.row_factoryTrue

@erlend-aasland
Copy link
ContributorAuthor

@CAM-Gerlach: I've reworded the reference, hopefully to the better; IMO the current version reflects the difference between the two row factory attributes more clearly. I also removed the example from ab98877; IMO it is superfluous with the now (hopefully) improved reference. Looking forward to your comments.

Copy link
Member

@CAM-GerlachCAM-Gerlach left a comment
edited
Loading

Choose a reason for hiding this comment

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

This is indeed looking pretty good, thanks. Follow-up suggestions are basically just textual tweaks.

Copy link
Member

@CAM-GerlachCAM-Gerlach left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me now, personally, Just a couple minor suggestions and followups to others' comments.

@merwokmerwok removed their request for reviewNovember 24, 2022 06:42
Copy link
Member

@CAM-GerlachCAM-Gerlach left a comment

Choose a reason for hiding this comment

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

Just one comment cleaning up my own mess, otherwise LGTM from my side, thanks.

erlend-aasland reacted with hooray emoji
@erlend-aasland
Copy link
ContributorAuthor

Thanks again y'all for improving this part of the docs. I'm going to land this later today. A lot of back and forth, but IMO totally worth it.

CAM-Gerlach reacted with hooray emoji

@erlend-aaslanderlend-aasland merged commit8749121 intopython:mainNov 25, 2022
@miss-islington
Copy link
Contributor

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

@erlend-aaslanderlend-aasland deleted the sqlite-docs/row-factory-how-to branchNovember 25, 2022 13:07
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestNov 25, 2022
(cherry picked from commit8749121)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
@bedevere-bot
Copy link

GH-99778 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelNov 25, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestNov 25, 2022
(cherry picked from commit8749121)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
@bedevere-bot
Copy link

GH-99779 is a backport of this pull request to the3.10 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.10only security fixes labelNov 25, 2022
miss-islington added a commit that referenced this pull requestNov 25, 2022
(cherry picked from commit8749121)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
miss-islington added a commit that referenced this pull requestNov 25, 2022
(cherry picked from commit8749121)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@merwokmerwokmerwok left review comments

@CAM-GerlachCAM-GerlachCAM-Gerlach left review comments

@ezio-melottiezio-melottiezio-melotti left review comments

@berkerpeksagberkerpeksagAwaiting requested review from berkerpeksagberkerpeksag is a code owner

Assignees

No one assigned

Labels

docsDocumentation in the Doc dirskip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@erlend-aasland@miss-islington@bedevere-bot@merwok@CAM-Gerlach@ezio-melotti

[8]ページ先頭

©2009-2025 Movatter.jp