Skip to content

Add some DB API 2.0 protocols and types - #6643

Merged
JelleZijlstra merged 1 commit into
python:masterfrom
srittau:dbapi
Dec 22, 2021
Merged

JelleZijlstra merged 1 commit into
python:masterfrom
srittau:dbapi

Conversation

@srittau

@srittau srittau commented Dec 21, 2021

Copy link
Copy Markdown
Collaborator

Closes: #1037

@srittau

srittau commented Dec 21, 2021

Copy link
Copy Markdown
Collaborator Author

The DB API 2.0 spec contains more mandatory items as well as a bunch of optional or "extension" items. These can be added as needed. The definitions above are useful for the SQLAlchemy stubs.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra
JelleZijlstra merged commit 0095536 into python:master Dec 22, 2021
@srittau
srittau deleted the dbapi branch December 22, 2021 08:18
@clbarnes

clbarnes commented Nov 8, 2024

Copy link
Copy Markdown

How do you actually import these in a project?

@srittau

srittau commented Nov 8, 2024

Copy link
Copy Markdown
Collaborator Author

@clbarnes You need to use:

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from _typeshed.dbapi import ...

Then you can use them either by quoting or when using from __future__ import annotations.

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.

PEP 249 Python Database API Specification v2.0

3 participants