A python library for sqlite3
Project description
#Quick Sql
It's a python library written purely in Python to do faster and better sqlite operations
Why Quick Sqlite?
- No need to write such a lengthy SQL code.
- No need to create custom function for query.
- Best for lightweight and simple Sqlite3 operations
- New features almost every week :)
Main Contents
- Database() Class containing methods and Sqlite operations.
- create_table() Function use to create table.
- insert() Function use to insert data.
- select_all() Function use to select all data from a column.
- select_from() Function use to select data from a single row.
- update() Function use to update data.
- delete() Function use to delet row.
Database()
Class
This is the class which is responsible for database creation and all the operation under a database.
Database(db_name)
Parameters
It takes one parameter.
db_name
Must be endswith ".db" extension
Database.create_table()
Function
This is the function which is used to create table in database
Database.create_table(table_name,**kwargs)
Parameters
It takes 1 or more parameters
table_name
Name of the table you want to be in your database- kwargs must be in the form
column_name = dtype
Dtype must be valid sqlite datatype.
Return
None
Database.insert()
Function
This function is used to insert data in table.
Database.insert(table_name,column,data_to_insert)
Parameters
It takes 3 parameters
table_name
Name of the table in which you want to insert data.columns
Name of the column in which you want to insert data. Must be list.data_to_insert
Data which you want to insert. Must be listlen(column)
must be equal tolen(data_to_insert)
column[0]
will store the data which is atdata_to_insert[0]
Note
Return
None
Database.select_all()
Function
This function is used to select all the data from a given column
Database.select_all(table_name,column,fetch="single")
Parameters
It takes 3 parameters , 2 are must and other is optional
table_name
Name of the table from which you want to get or select data.column
Name of the column.fetch
This depend upon you if you want tofetchall()
use "all" otherwise "single". Default is "single"
Return
Tuple
Database.select_from()
Function
This function is used to select data from a particular row.
Database.select_from(table_name,column,from_where,fetch="single")
Parameters
It takes 4 parameter, 3 are must and other is optional
table_name
Name of the table from which you want to get or select data.column
Name of the column.from_where
It is the list of value and a pair from where you want to get data.fetch
This depend upon you if you want tofetchall()
use "all" otherwise "single". Default is "single"len(from_where)
should be equals to 2from_where[0]
should be a column name andfrom_where[1]
should be the value of that column which belongs to a row.
Note
Return
Tuple
Database.update()
Function
This function is use to update data of table.
Database.update(table_name,column,value,from_where)
Parameters
It takes 4 parameters.
table_name
The table in which you want to update data.column
Column name. Must be a list.value
Value which going to be store in that. Must be a list.from_where
Pair of column and value. Must be a list.len(column)
==len(value)
column[0]
store the data invalue[0]
Note
Return
None
Database.delete()
Function
This function is use to update data of table.
Database.update(table_name,from_where)
Parameters
It takes 2 parameters.
table_name
The table in which you want to delete data.from_where
Pair of column and value.
Return
None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file quick-sql-1.0.1.tar.gz
.
File metadata
- Download URL: quick-sql-1.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b62a70d0a4665533d04a2a844e0ec052fd5a77c464840121e9a70a976eb6b5e |
|
MD5 | 4b9a86cd24cd118650d93202e9d9acf0 |
|
BLAKE2b-256 | 687de988da0d33c5ab8a0e20bc33b9fa06df72fdd7c7fbb17282f4f6afc3522d |