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

Appearance settings

bpo-45243: Expose SQLite connection limits as sqlite3.Connection attributes#28790

Closed
erlend-aasland wants to merge 5 commits into
python:mainpython/cpython:mainfrom
erlend-aasland:sqlite-limits-as-attributeserlend-aasland/cpython:sqlite-limits-as-attributesCopy head branch name to clipboard
Closed

bpo-45243: Expose SQLite connection limits as sqlite3.Connection attributes#28790
erlend-aasland wants to merge 5 commits into
python:mainpython/cpython:mainfrom
erlend-aasland:sqlite-limits-as-attributeserlend-aasland/cpython:sqlite-limits-as-attributesCopy head branch name to clipboard

Conversation

@erlend-aasland

@erlend-aasland erlend-aasland commented Oct 7, 2021

Copy link
Copy Markdown
Contributor

@erlend-aasland

Copy link
Copy Markdown
Contributor Author

Proposed alternative to #28463.

Comment thread Modules/_sqlite/connection.c Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Casting the limit macros to void * and back again to int is perhaps a little bit too hackish. But it does allow for a single getter/setter.

@erlend-aasland erlend-aasland force-pushed the sqlite-limits-as-attributes branch from a0c1251 to f4b9fcd Compare October 7, 2021 12:56
@erlend-aasland erlend-aasland force-pushed the sqlite-limits-as-attributes branch from 5ec4adb to d04794d Compare October 7, 2021 13:29
@serhiy-storchaka

Copy link
Copy Markdown
Member
old = con.SQLITE_LIMIT_LENGTH
con.SQLITE_LIMIT_LENGTH = new

does not look nice to me. If go this way, I would prefer

old = con.limit.length
con.limit.length = new

But do we have precedences of such getters and setters in the stdlib?

There are also disadvantages in comparison with traditional getlimit()/setlimit().

  1. setlimit() sets a new limit and returns an old limit at one operation. Atomically (guarded by the GIL).
  2. getlimit()/setlimit() can be used for new limits not supported by the sqlite3 module yet. Just use some numeric constant.

@erlend-aasland

Copy link
Copy Markdown
Contributor Author

I'm not aware of similar attributes in the stdlib. I have no strong preference regarding this approach and GH-28463. I'm fine with closing this in favour of GH-28463.

@erlend-aasland erlend-aasland deleted the sqlite-limits-as-attributes branch October 7, 2021 18:47
@erlend-aasland

Copy link
Copy Markdown
Contributor Author

This approach will be more tedious to maintain. I'm closing this in favour of GH-28463.

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.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.