Python Wrapper For sqlite3 and aiosqlite

Overview

dblite

GitHub issues GitHub forks GitHub stars GitHub license PyPI - Python Version

Python wrapper for sqlite3 & aiosql

Table of Contents

Installation

To install dblite, simply:

$ python3 -m pip install -U git+https://github.com/anbuhckr/dblite.git

Getting Started

#! /usr/bin/env python3

import asyncio
from dblite import dbLite, aioDbLite

def main():
    db = dbLite('db1.db')
    db.create('users', id='int', name='text', age='int', pos='text')
    print(db.data('users'))
    db.add('users', id=1, name='Jhon', age=32, pos='Developer')
    db.add('users', id=2, name='Doe', age=30, pos='Manager')
    db.add('users', id=3, name='Rio', age=29, pos='Marketing')
    print(db.data('users'))
    db.remove('users', id=3)
    print(db.data('users'))
    db.update('users', age=31, pos='CEO', id=1)
    print(db.data('users'))
    print(db.select('users', '*', id=1))
    db.close()

async def amain():
    aiodb = await aioDbLite('db2.db')
    await aiodb.create('users', id='int', name='text', age='int', pos='text')
    print(await aiodb.data('users'))
    await aiodb.add('users', id=1, name='Jhon', age=32, pos='Developer')
    await aiodb.add('users', id=2, name='Doe', age=30, pos='Manager')
    await aiodb.add('users', id=3, name='Rio', age=29, pos='Marketing')
    print(await aiodb.data('users'))
    await aiodb.remove('users', id=3)
    print(await aiodb.data('users'))
    await aiodb.update('users', age=31, pos='CEO', id=1)
    print(await aiodb.data('users'))
    print(await aiodb.select('users', '*', id=1))
    await aiodb.close()

main()
asyncio.run(amain())

Result:

# sync
# create table
[]
# add data
[(1, 'Jhon', 32, 'Developer'), (2, 'Doe', 30, 'Manager'), (3, 'Rio', 29, 'Marketing')]
# remove Rio
[(1, 'Jhon', 32, 'Developer'), (2, 'Doe', 30, 'Manager')]
# update Jhone age
[(1, 'Jhon', 31, 'CEO'), (2, 'Doe', 30, 'Manager')]
# show user with id 1
[(1, 'Jhon', 31, 'CEO')]


# async
# create table
[]
# add data
[(1, 'Jhon', 32, 'Developer'), (2, 'Doe', 30, 'Manager'), (3, 'Rio', 29, 'Marketing')]
# remove Rio
[(1, 'Jhon', 32, 'Developer'), (2, 'Doe', 30, 'Manager')]
# update Jhone age
[(1, 'Jhon', 31, 'CEO'), (2, 'Doe', 30, 'Manager')]
# show user with id 1
[(1, 'Jhon', 31, 'CEO')]
You might also like...
python-beryl, a Python driver for BerylDB.
python-beryl, a Python driver for BerylDB.

python-beryl, a Python driver for BerylDB.

Motor - the async Python driver for MongoDB and Tornado or asyncio
Motor - the async Python driver for MongoDB and Tornado or asyncio

Motor Info: Motor is a full-featured, non-blocking MongoDB driver for Python Tornado and asyncio applications. Documentation: Available at motor.readt

Motor - the async Python driver for MongoDB and Tornado or asyncio
Motor - the async Python driver for MongoDB and Tornado or asyncio

Motor Info: Motor is a full-featured, non-blocking MongoDB driver for Python Tornado and asyncio applications. Documentation: Available at motor.readt

A Python library for Cloudant and CouchDB

Cloudant Python Client This is the official Cloudant library for Python. Installation and Usage Getting Started API Reference Related Documentation De

Simple DDL Parser to parse SQL (HQL, TSQL, AWS Redshift, Snowflake and other dialects) ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc.

Simple DDL Parser Build with ply (lex & yacc in python). A lot of samples in 'tests/. Is it Stable? Yes, library already has about 5000+ usage per day

A simple python package that perform SQL Server Source Control and Auto Deployment.

deploydb Deploy your database objects automatically when the git branch is updated. Production-ready! ⚙️ Easy-to-use 🔨 Customizable 🔧 Installation I

A library for python made by me,to make the use of MySQL easier and more pythonic

my_ezql A library for python made by me,to make the use of MySQL easier and more pythonic This library was made by Tony Hasson , a 25 year old student

Py2neo is a client library and toolkit for working with Neo4j from within Python

Py2neo Py2neo is a client library and toolkit for working with Neo4j from within Python applications. The library supports both Bolt and HTTP and prov

MongoX is an async python ODM for MongoDB which is built on top Motor and Pydantic.
MongoX is an async python ODM for MongoDB which is built on top Motor and Pydantic.

MongoX MongoX is an async python ODM (Object Document Mapper) for MongoDB which is built on top Motor and Pydantic. The main features include: Fully t

Comments
  • Replace method. Custom connect arguments.

    Replace method. Custom connect arguments.

    This fix for not passing isolation_level and check_same_thread arguments to connect function and now it possible to pass custom arguments:

    aiodb = await aioDbLite('custom.db', detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
    

    Also new replace method is very useful in tables where primary key is not autoincremented.

    opened by vasia123 0
Releases(v1.2.0)
An extension package of 🤗 Datasets that provides support for executing arbitrary SQL queries on HF datasets

datasets_sql A 🤗 Datasets extension package that provides support for executing arbitrary SQL queries on HF datasets. It uses DuckDB as a SQL engine

Mario Šaško 19 Dec 15, 2022
Pure-python PostgreSQL driver

pg-purepy pg-purepy is a pure-Python PostgreSQL wrapper based on the anyio library. A lot of this library was inspired by the pg8000 library. Credits

Lura Skye 11 May 23, 2022
The Database Toolkit for Python

SQLAlchemy The Python SQL Toolkit and Object Relational Mapper Introduction SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that giv

SQLAlchemy 6.5k Jan 01, 2023
MySQLdb is a Python DB API-2.0 compliant library to interact with MySQL 3.23-5.1 (unofficial mirror)

==================== MySQLdb Installation ==================== .. contents:: .. Prerequisites ------------- + Python 2.3.4 or higher * http://ww

Sébastien Arnaud 17 Oct 10, 2021
Records is a very simple, but powerful, library for making raw SQL queries to most relational databases.

Records: SQL for Humans™ Records is a very simple, but powerful, library for making raw SQL queries to most relational databases. Just write SQL. No b

Kenneth Reitz 6.9k Jan 03, 2023
Familiar asyncio ORM for python, built with relations in mind

Tortoise ORM Introduction Tortoise ORM is an easy-to-use asyncio ORM (Object Relational Mapper) inspired by Django. Tortoise ORM was build with relati

Tortoise 3.3k Dec 31, 2022
ClickHouse Python Driver with native interface support

ClickHouse Python Driver ClickHouse Python Driver with native (TCP) interface support. Asynchronous wrapper is available here: https://github.com/myma

Marilyn System 957 Dec 30, 2022
PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.

PyPika - Python Query Builder Abstract What is PyPika? PyPika is a Python API for building SQL queries. The motivation behind PyPika is to provide a s

KAYAK 1.9k Jan 04, 2023
Implementing basic MongoDB CRUD (Create, Read, Update, Delete) queries, using Python.

MongoDB with Python Implementing basic MongoDB CRUD (Create, Read, Update, Delete) queries, using Python. We can connect to a MongoDB database hosted

MousamSingh 4 Dec 01, 2021
Pysolr — Python Solr client

pysolr pysolr is a lightweight Python client for Apache Solr. It provides an interface that queries the server and returns results based on the query.

Haystack Search 626 Dec 01, 2022
A simple python package that perform SQL Server Source Control and Auto Deployment.

deploydb Deploy your database objects automatically when the git branch is updated. Production-ready! ⚙️ Easy-to-use 🔨 Customizable 🔧 Installation I

Mert Güvençli 10 Dec 07, 2022
A framework based on tornado for easier development, scaling up and maintenance

turbo 中文文档 Turbo is a framework for fast building web site and RESTFul api, based on tornado. Easily scale up and maintain Rapid development for RESTF

133 Dec 06, 2022
Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.

dataset: databases for lazy people In short, dataset makes reading and writing data in databases as simple as reading and writing JSON files. Read the

Friedrich Lindenberg 4.2k Jan 02, 2023
Use SQL query in a jupyter notebook!

SQL-query Use SQL query in a jupyter notebook! The table I used can be found on UN Data. Or you can just click the link and download the file undata_s

Chuqin 2 Oct 05, 2022
This repository is for active development of the Azure SDK for Python.

Azure SDK for Python This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public

Microsoft Azure 3.4k Jan 02, 2023
Py2neo is a comprehensive toolkit for working with Neo4j from within Python applications or from the command line.

Py2neo Py2neo is a client library and toolkit for working with Neo4j from within Python applications and from the command line. The library supports b

Nigel Small 1.2k Jan 02, 2023
A fast PostgreSQL Database Client Library for Python/asyncio.

asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio asyncpg is a database interface library designed specifically for PostgreSQL a

magicstack 5.8k Dec 31, 2022
CouchDB client built on top of aiohttp (asyncio)

aiocouchdb source: https://github.com/aio-libs/aiocouchdb documentation: http://aiocouchdb.readthedocs.org/en/latest/ license: BSD CouchDB client buil

aio-libs 53 Apr 05, 2022
A simple wrapper to make a flat file drop in raplacement for mongodb out of TinyDB

Purpose A simple wrapper to make a drop in replacement for mongodb out of tinydb. This module is an attempt to add an interface familiar to those curr

180 Jan 01, 2023
SQL queries to collections

SQC SQL Queries to Collections Examples from sqc import sqc data = [ {"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 3, "b": 2}, ] Simple filte

Alexander Volkovsky 0 Jul 06, 2022