-
Notifications
You must be signed in to change notification settings - Fork 65
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
Initial pass on Python API #276
Conversation
81e71f3
to
aff52ee
Compare
Let's make sure the API follows PEP 249 (https://peps.python.org/pep-0249/), preferably so that it's a drop-in replacement for the sqlite3 API in Python: https://docs.python.org/3/library/sqlite3.html |
62e914a
to
7262dc6
Compare
@penberg I've refactored the code to comply with PEP 249. What do you think? |
|
||
|
||
def test_sqlite3_fetchall_select_all_users(): | ||
conn = sqlite3.connect("tests/database.db") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change this now, but you can use @pytest annotation to parametrize a same test case to run with both libraries. See, for example, https://github.com/tursodatabase/libsql-experimental-python/blob/main/tests/test_suite.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Looks great @JeanArhancet! All we need to figure out is how to get this to build on Windows... 🙈 |
bindings/python/src/lib.rs
Outdated
/** | ||
* This read/write attribute specifies the number of rows to fetch at a time with .fetchmany(). | ||
* It defaults to 1 meaning to fetch a single row at a time. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, this is not rustdoc style, see https://doc.rust-lang.org/rust-by-example/meta/doc.html for examples.
9e21491
to
e09ee75
Compare
refactor: pep-0249 refactor: rust comment and requirements-dev.txt fix: name conflict
e09ee75
to
3e8f886
Compare
This pull request introduces the initial setup for the Python bindings (#248). - Setup Configuration: Added the Python binding stack, including the `pyo3 `crates, `pyproject.toml`, `build.rs`, and other necessary files. - Database Class: Implemented the Database class with a constructor to establish a connection and a query function to execute SQL queries. - Testing: Created `database.db` with a sample users table and two entries, as outlined in README.md, and added three pytest functions to validate the Python output. Closes #276
This pull request introduces the initial setup for the Python bindings (#248).
pyo3
crates,pyproject.toml
,build.rs
, and other necessary files.database.db
with a sample users table and two entries, as outlined in README.md, and added three pytest functions to validate the Python output.