Skip to main content

Simple alternative to SQLAlchemy(Sqlite, Oracle 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 '))

ORACLE

1 - Import file

from allsql import Oracle

2 - Oracle([user],[password],[host],[sid],[auto commit])

db = Oracle('user','user_pass','127.0.0.1','orcl',True)

3 - db.create_table([table],[columns type parameters])

db.create_table('tb_test', 'id integer primary key autoincrement, 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 '))

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.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

allsql-0.0.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file allsql-0.0.3.tar.gz.

File metadata

  • Download URL: allsql-0.0.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for allsql-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2c7bbc687bcc97c87a4b465c333b9693048418dd3742cb7efd54b70da9c8e662
MD5 b818cd6c748e05a993411d51c25058c3
BLAKE2b-256 40384f4a6cb11c51a703228d60f86e68b6a45e9f76e5b6c4d9fb9d3fe5710687

See more details on using hashes here.

File details

Details for the file allsql-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: allsql-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for allsql-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d42e008c744820b814f567611270048803d9428c48b18fa844ee27db686c38a9
MD5 76494d6f4af42aba944e1e1e2509336a
BLAKE2b-256 d186d1489feff990820b95c566275ddaa9128a1f045b03b566e3993c835f8a15

See more details on using hashes here.

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