Skip to main content

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

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

Examples

Here is an example


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

Examples

Here is an example

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_insertData which you want to insert. Must be list
  • Note

    • len(column) must be equal to len(data_to_insert)
    • column[0] will store the data which is at data_to_insert[0]

Return

None

Examples

Here is an exmaple.

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 to fetchall() use "all" otherwise "single". Default is "single"

Return

Tuple

Examples

Here is an example.

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 to fetchall() use "all" otherwise "single". Default is "single"
  • Note

    • len(from_where) should be equals to 2
    • from_where[0] should be a column name and from_where[1] should be the value of that column which belongs to a row.

Return

Tuple

Examples

Here is an example.

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.
  • Note

    • len(column) == len(value)
    • column[0] store the data in value[0]

Return

None

Examples

Here is an example.

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

Examples

Here is an example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quick-sql-1.0.1.tar.gz (4.6 kB view details)

Uploaded Source

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

Hashes for quick-sql-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0b62a70d0a4665533d04a2a844e0ec052fd5a77c464840121e9a70a976eb6b5e
MD5 4b9a86cd24cd118650d93202e9d9acf0
BLAKE2b-256 687de988da0d33c5ab8a0e20bc33b9fa06df72fdd7c7fbb17282f4f6afc3522d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page