A comprehensive SQLite3 utility package simplifying database interactions. Perform CRUD operations effortlessly and manage tables with ease. Enhance your Python projects with seamless SQLite3 integration using our collection of convenient functions
SQLite comes bundled with most programming languages, and you can interact with it using libraries specific to the language you're using. However, if you want to use the sqlite3
command-line tool, you might need to install it separately.
Here are instructions for common operating systems:
sudo apt-get update
sudo apt-get install sqlite3
brew install sqlite3
- Download the SQLite tools from the SQLite website: https://www.sqlite.org/download.html
- Choose the appropriate precompiled binaries for Windows.
- Extract the downloaded ZIP file and add the path to the
sqlite3.exe
executable to your system's PATH environment variable.
After installation, you can test it by opening a command prompt or terminal and typing sqlite3
. If installed successfully, it should open the SQLite command-line shell.
Remember that if you are using SQLite in a specific programming language like Python, you usually don't need to install SQLite separately, as it is often included with the language's standard library or easily installable using a package manager specific to that language (e.g., sqlite3
module for Python).
-
Clone the repository:
pip install sqlite3utils```
-
Navigate to the project directory:
from sqlite3utils import list_tables ...
-
Create app.py and set up your SQLite database:
from sqlite3utils import list_tables database = "mydb.db" print(list_tables(database))
Explain how to use your project or provide examples.
python app.py
List of functions available with brief descriptions:
def list_tables(database_url):
"""List all tables in the SQLite database."""
# Implementation
def create_table(database_url, table_name, columns):
"""Create a new table in the SQLite database."""
# Implementation
def insert(database_url, table_name, data):
"""Insert a single record into the specified table."""
# Implementation
def insert_many(database_url, table_name, data_list):
"""Insert multiple records into the specified table."""
# Implementation
def select_all(database_url, table_name):
"""Retrieve all records from the specified table."""
# Implementation
def select_with_pagination(database_url, table_name, from_index, to_index):
"""Retrieve records from the specified table with pagination."""
# Implementation
def select_by_column(database_url, table_name, column_name, column_value):
"""Retrieve records from the specified table based on a column value."""
# Implementation
def select(database_url, table_name, where_dict):
"""Retrieve records from the specified table based on conditions."""
# Implementation
def update(database_url, table_name, update_dict, where_dict):
"""Update records in the specified table based on conditions."""
# Implementation
def delete(database_url, table_name, where_dict):
"""Delete records from the specified table based on conditions."""
# Implementation
def truncate(database_url, table_name):
"""Remove all records from the specified table without deleting the table."""
# Implementation
def delete_table(database_url, table_name):
"""Delete the specified table from the database."""
# Implementation
def sql_query(database_url, raw_sql_query):
"""Execute a raw SQL query on the database."""
# Implementation
Provide a simple example or usage of each function.
# Example usage of create_table function
create_table("my_database.db", "employees", ["id INTEGER", "name TEXT", "salary REAL"])
If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/new-feature
. - Make your changes and commit them:
git commit -m 'Add new feature'
. - Push to the branch:
git push origin feature/new-feature
. - Submit a pull request.
This project is licensed under the MIT License.