Simple alternative to SQLAlchemy(Sqlite and MySql)
Project description
SQLITE3
1 - Import file
from allsql import Sqlite
2 - Sqlite([local database])
db = Sqlite('database.db')
3 - db.create_database([database])
db.create_database(db)
4 - db.create_table([table],[columns type parameters])
db.create_table('tb_test', 'id integer primary key autoincrement, name text, status integer')
5 - db.truncate_table([table])
db.truncate_table('tb_test')
6 - db.drop_table([table])
db.drop_table('tb_test')
7 - db.insert([table],[columns],[values])
db.insert('tb_test', 'name,status', '"Joe Climb",0')
8 - db.update([table],[set],[where])
db.update('tb_test', 'name = "Joe Caruzo", status = 0', 'status = 1')
9 - db.delete([table],[where])
db.delete('tb_test','id = 1, status = 0')
10 - db.select([table],[columns],[where],[groupby],[orderby])
print(db.select('tb_test','name,count(*)','id > 0, status != 0', 'name', 'name asc'))
11 - db.sql([query])
print(db.sql('select * from tb_test '))
MYSQL
1 - Import file
from allsql import Mysql
2 - Mysql([user],[password],[host],[sid])
db = Mysql('<user>','<user_pass>','<host>','<dba>')
3 - db.create_table([table],[columns type parameters])
db.create_table('tb_test', 'id integer primary key auto_increment, name text, status integer')
4 - db.truncate_table([table])
db.truncate_table('tb_test')
5 - db.drop_table([table])
db.drop_table('tb_test')
6 - db.insert([table],[columns],[values])
db.insert('tb_test', 'name,status', '"Joe Climb",0')
7 - db.update([table],[set],[where])
db.update('tb_test', 'name = "Joe Caruzo", status = 0', 'status = 1')
8 - db.delete([table],[where])
db.delete('tb_test','id = 1, status = 0')
9 - db.select([table],[columns],[where],[groupby],[orderby])
print(db.select('tb_test','name,count(*)','id > 0, status != 0', 'name', 'name asc'))
10 - db.sql([query])
print(db.sql('select * from tb_test '))
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
allsql-0.0.5.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file allsql-0.0.5.tar.gz
.
File metadata
- Download URL: allsql-0.0.5.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ece9e12656ff1ee5f1a5a2b4e89192ad1c98968254d34a7d0ae6f9b012464fdb |
|
MD5 | 83b8c5e714c56c6b32fc418be70f624c |
|
BLAKE2b-256 | 7858658b3de7a0363969d12f874eb3b49cd421225372019beb49495dd5e8ad80 |
File details
Details for the file allsql-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: allsql-0.0.5-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edf17df5f551aa01faf0bc695091ae01cf1ecc1c89b100a0eb70f19c6cebee72 |
|
MD5 | 44da8524775570121f52c0f66801c334 |
|
BLAKE2b-256 | 6e3ccc4436eff217b7cfe6d79e12b52e25da5078490077ee4ad155a6378f9bba |