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-108364: In sqlite3, disable foreign keys before dumping SQL schema#108471

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 commentedAug 25, 2023
edited by bedevere-bot
Loading

@erlend-aasland
Copy link
ContributorAuthor

I'm not sure who in the core team to call upon for a review of this.@felixxm, are you up for a review? 😃

felixxm reacted with thumbs up emoji


writeable_schema=False
cu=connection.cursor()
yield('PRAGMA foreign_keys=OFF;')
Copy link
Contributor

Choose a reason for hiding this comment

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

This is consistent with the sqlite CLI .dump but seems to contradict the documentationhere (section 2). Perhaps we should queryforeign_keys for future proofing?

Excerpt from section 2:
Foreign key constraints are disabled by default (for backwards compatibility), so must be enabled separately for eachdatabase connection. (Note, however, that future releases of SQLite might change so that foreign key constraints enabled by default. Careful developers will not make any assumptions about whether or not foreign keys are enabled by default but will instead enable or disable them as necessary.)

Copy link
Contributor

@felixxmfelixxmAug 31, 2023
edited
Loading

Choose a reason for hiding this comment

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

I don't think we can make assumptions about a connection on which the dump will be imported. We can check if there is any foreign key violation on the source database before adding this, e.g.

violations=cursor.execute("PRAGMA foreign_key_check").fetchall()iflen(violations)>0:yield('PRAGMA foreign_keys=OFF;')

CorvinM and erlend-aasland reacted with thumbs up emoji
Copy link
Contributor

@felixxmfelixxmSep 20, 2023
edited
Loading

Choose a reason for hiding this comment

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

@erlend-aasland Do you need help with this patch?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@felixxm: I currently have very little bandwidth for CPython development. Feel free to take this over, if you want.

felixxm reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Updated in#113957.

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

Reviewers

@berkerpeksagberkerpeksagAwaiting requested review from berkerpeksagberkerpeksag is a code owner

2 more reviewers

@felixxmfelixxmfelixxm left review comments

@CorvinMCorvinMCorvinM left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@erlend-aasland@felixxm@CorvinM@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp