Skip to content
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

Add Sqlite plugin #154

Merged
merged 4 commits into from
Jan 10, 2025

Conversation

shravankshenoy
Copy link
Contributor

@shravankshenoy shravankshenoy commented Dec 11, 2024

Fixes #116

Demo

Sqlite.Plugin.Demo.mp4

Things to Consider

  • The sqlite3 library by default does not throw an error if a database is not present, instead it creates a new database. To avoid this, while using the sqlite3.connect() function to connect, we pass a URI instead of a file path, and add mode=rw to its query string. This ensures it only connects to an existing database and does not create a new one (https://www.sqlite.org/c3ref/open.html)
  • Default output is list of tuples, to get list of dictionary, we must modify the row factory (as has been done in the code using the _dict_factory function)
  • The sqlite_master schema table has been used to obtain table metadata, and to get column metadata, the pragma_table_info table valued function has been used (https://www.sqlite.org/pragma.html)
  • For the above demo, the sqlite database file was kept in the root folder

@shravankshenoy shravankshenoy marked this pull request as ready for review December 17, 2024 06:28
@agberoz agberoz requested a review from amilmshaji January 9, 2025 13:00
Copy link
Collaborator

@amilmshaji amilmshaji left a comment

Choose a reason for hiding this comment

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

Used a Thread-Safe SQLite Connection

@ashmilhussain ashmilhussain merged commit a6783ef into sirocco-ventures:main Jan 10, 2025
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.

Add SQLite Plugin
3 participants