Skip to main content

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 hashes)

Uploaded Source

Built Distribution

allsql-0.0.5-py3-none-any.whl (3.7 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