A simple database query for python!
Install:
For the stable ver (recommended):
pip install PyDBQuery
For the dev ver:
pip install PyDBQuery==0.2dev
Examples:
Sqlite3:
from pydbquery import sqlite3
db = sqlite3.Database(filename='data.db')
person_table = db.create_table("Person", name=str, age=int, job=str)
person_table.add(name="Jhonny", age=28, job="Programmer")
person_table.add(name="Anna", age=23, job="Designer")
person_list = person_table.all()
print(person_list.objects)
jhonny = person_list.filter(name="Jhonny")
if len(jhonny) > 0:
jhonny = jhonny[0]
print(jhonny.name, jhonny.age, jhonny.job, sep=' - ')
jhonny.age = 30
jhonny.save()
print(jhonny.age)
Supported DataTypes (including data inside list-like datatypes): int, float, str, dict, set, list, tuple
Attention! (float, dict, set, list, tuple) types are only available in release v0.2dev.
An portuguese example: click heeeeereeeee!
For more informations please visit the docs!