Skip to main content

HydraDB v3.1.1

An API for Faster and Easier SQLite/Python Operations

GitHub Repo: https://github.com/rhmtazad/hydradb/


An API for Python and SQLite to manage databases faster and easier. You can now add, modify, or fetch tables, columns, and rows easily in no time. Also, you can execute/fetch custom queries using built-in functions for your specific problems. This API applies some design patterns and principles of OOP for reusability of the codes.


Requirements

To make hydraDB work properly you must have installed:

  • [Python 3.9] - Latest version of Python
  • [SQLite3] - Latest version of SQLite3

Installation

You can install through pip or by copying 'hydra' package inside your project folder

pip install hydradb

How to Import and Use the API

To import the package inside your project:

from hydra import Schema

To have access to the operations:

  • If the name or location is not passed as parameters, it will set them to default

  • The default for the name is 'main' and the default for the directory is the project directory.

  • The database file will be saved with '.db' extension.

    name = 'myDB' location = 'C:\Projects\Python'

    db = Schema(name, location) # or use Schema() without passing parameter values


General Operations

Execute a query from the database:

execute(query) # execute('select * from tbl')

Fetch a query from the database:

fetch(query) # fetch('select * from tbl')

Table Operations

Add one or more tables in database:

add_table(*tables) # add_table('tbl1', 'tbl2', tbl3')

Drop one or multiple tables from a database:

drop_table(*tables) # drop_table('tbl1', 'tbl2', 'tbl3')

Rename a table from the database:

rename_table(old_name, new_name) # rename_table('old', 'new')

Create a table with the given columns:

form_table(table, columns) # form_table(table='tbl', name='text', age='integer')

Copy a table's data to a new one:

copy_table(origin_tbl, new_tbl, columns) # copy_table('origin', 'new', col1='text')

Fetch a table's data from a database:

fetch_table(table) # fetch_table('student')

Column Operations

Add one or more columns to a table:

add_column(table, columns) # add_column('tbl', name='text', age='integer')

Drop one or more columns from a table:

drop_column(table, columns) # drop_column('tbl', name='text', age='integer')

Add a column to a table and set it as a foreign key:

add_fk(table, column, reference_tbl, reference_col)

Rename a column from a table:

rename_column(tbl, current_name, new_name)

Fetch one or more columns from a table:

fetch_columns(table, *columns) # fetch_columns('tbl', 'name', 'age')

Fetch column names from a table:

fetch_column_names(table)

Filter based on one or more column's values:

filter_column(table, **col_val) # filter_column('tbl', name='R', age=25)

Row Operations

Insert a row in a table:

insert_row(table, data) # insert_row('tbl', name='R', age='25')

Delete a row from a table:

delete_row(table, row_id) # delete_row(table='student', row_id=1)

Update a row in a table:

update_row(table, row_id, data) # update_row(table='student', row_id=1, name='R')

Fetch one or more cells within a row:

filter_row(table, row_id, *columns)

Fetch a cells within a row:

fetch_cell(table, row_id, column)

Fetch a row from a table:

fetch_row(table, row_id)

Count number of rows based on columns and their values:

count_rows(table, col_val) # count_rows(table='tbl', name='R', age=25)

License

MIT License

Copyright 2021 Rahmat Azad

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for hydradb 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hydradb 3.1.1
File Size Uploaded
hydradb-3.1.1.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hydradb 3.1.1
File Interpreter ABI Platform
hydradb-3.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.2 kB

Release files / hydradb-3.1.1.tar.gz

Download URL hydradb-3.1.1.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
008f136b70718645d928e6af7d7cb71fc514c248ec5bf0eb7131e5e7fa856490
BLAKE2b-256 checksum
How to use checksums
9d8768374d14aea44bb947f48f77040f7bed68f717c67327a705d1a4ac8bb5fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / hydradb-3.1.1-py3-none-any.whl

Download URL hydradb-3.1.1-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84f3ec9d159f3090489be650b05d4048a600572aac9d1cb3d2abd568a6efea36
BLAKE2b-256 checksum
How to use checksums
a947dc6d93cffc0bc1063a1066455f3d3cdb2472f0de2cdf527f0c6939e9f95b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

3.1.1 This release

2 release files

3.0.0

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4

2 release files

2.3

2 release files

2.2

2 release files

2.1

1 release file

2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page