Skip to main content

Python3 tool to create and handle very quickly a sqlite3 database in an application

Project description

logo silly db

Silly DB

Quick and easy SQLite database for local python applications.

Is it an ORM ?

It is indeed a reversed ORM:

  • The structure of the DB is built from classic .sql files.
  • Then the magic occures to get the models from the DB itself. Usually, an ORM does the contrary.

Some minimum SQL knowledge is required, the purpose of Silly DB is not to get rid of SQL (actualy, SQL is the best language to manage... a SQL database), but to handle the a lot of boring things, and let you focus on your application with a minimum amount of code.

The required knowledge and much more is available here :

You should consider using :

No need to be an expert, just understand own to create a DB and use 'SELECT' will be fine.

Installation

$ pip install silly_db

Fast way to begin

Create a new directory and open a console in there.

Get a basic working structure with 'plop':

$ python3 -m silly_db.plop db

Congratulations ! You've got your database ready to work ! To understand how it works, open the differents files provided and read the comments, it will be easy to adapt to your own needs.

get more info with:

$ python3 -m silly_db

and more about the plop options here:

$ python3 _n silly_db.plop

Examples

from silly_db.db import DB

db = DB(file="database/my_db.sqlite3", migrations_dir="database/migrations")
db.migrate_all()

Cat = db.model('cat')
Person = db.model('person')

Cat.insert(name="Kutty", owner_id=1)
cats = Cat.filter("name like 'K%'")
print(cats.jsonify())

>>>[{'id': 58, 'name': 'Kutty', 'owner_id': 1}]

Documentation

Take a look at the wiki here

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

silly-db-1.1.0.tar.gz (10.3 kB view hashes)

Uploaded Source

Built Distribution

silly_db-1.1.0-py3-none-any.whl (13.6 kB view hashes)

Uploaded Python 3

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