eSQL | SQLite manager
Manage your SQLite like django models.
See full documention here.
Example:
import eSQL
eSQL.connect("database.db")
class User(eSQL.Model):
id = eSQL.IntegerField(primary_key=True, not_null=True)
name = eSQL.TextField(not_null=True)
eSQL.migrate()
# ...
Installion
pip3 install eSQL
After install eSQL, import that to test:
>>> import eSQL
>>> eSQL.__version__
...
get started
Can using eSQL like django.
connect to database
First step import that and connect to database.
import eSQL
eSQL.connect("database.db")
create models
always you need tables in database, define tables with eSQL.Model
:
class Users(eSQL.Model):
id = eSQL.IntegerField(primary_key=True, not_null=True)
name = eSQL.TextField(not_null=True)
username = eSQL.CharField(max_length=150)
password = eSQL.CharField(max_length=20)
Note1: if variables starts with _
, model ignore that.
Note2: if variable named objects
, model ignore that.
migrate tables in database
Use eSQL.migrate()
:
eSQL.migrate()
Can use eSQL.sqlmigrate()
to get sql statement:
__sql = eSQL.sqlmigrate()
print(__sql)
Learn More
Learn more here.
drop, insert, delete, select, transaction, ...