A wrapper for SQLite and MySQL, Most of the queries wrapped into commands for ease.
Project description
Before you proceed, make sure you know Some real SQL, before looking at the code, otherwise you probably won't understand anything.
Installation
pip install EasierSQL
EasySQLite code examples -:
import EasierSQLite
database = EasierSQLite.easierSQLite("dataBaseName")
# Creating a table
created_Table = database.create_Table('table_Name','userName TEXT NOT NULL, userID INT PRIMARY KEY')
"""
The second argument is where you write the Column names, their Datatypes and constraints!
Also there is an optional third argument called 'check_if_exists' by default it is True.
"""
print(created_Table) # Returns the result.
# Inserting values into a table.
insert = database.insert_values('table_Name','columns_names','values_here')
print(insert) # Returns the result.
# Getting values from a table
selected_value = database.select_values('table_Name', columnNames='column_Names',limit='1000',clauses='here')
"""
Most of the arguemnts here, have default values for example,
If you leave columnNames blank it will get all the values from the rows by default.
If you leave limit blank, it will get 100 rows max from the table by default.
In the clauses argument you can add your where clause, cases etc. If left none it won't affect anything.
"""
print(selected_value) # Returns the list of values (or an error).
To compensate for no documentation at the moment, here are all the functions.
database.create_Table()
database.select_values()
database.insert_values()
database.delete_table()
database.create_new_column()
database.delete_row()
database.rename_Table()
database.rename_Column()
database.attach_database()
database.detach_database()
database.execute_custom_query() # Returns the database, so you can execute Your own query, if the module doesn't support that type.
Example of execute_custom_query()
import EasierSQLite
database = EasierSQLite.easierSQLite("dataBaseName")
tempDB = database.execute_custom_query()
cursor = tempDB.cursor()
cursor.execute("SQL_QUERY")
# tempDB.commit() COMMIT IF NECESSARY
tempDB.close() # Close database after done with it for good practice.
EasyMySQL Code example -:
import EasierMySQL
database = EasierMySQL.easierMySQL(
userName = 'userNAME',
passwrd = 'password',
host = 'host'
database = 'database'
)
# Creating a table
created_Table = database.create_Table('table_Name','userName VARCHAR(20) NOT NULL, userID INT PRIMARY KEY')
print(created_Table) # Returns the result.
# Inserting values into a table.
insert = database.insert_values('table_Name','columns_names','values_here')
print(insert) # Returns the result.
# Getting values from a table
selected_value = database.select_values('table_Name', columnNames='column_Names',limit='1000',clauses='here')
print(selected_value) # Returns the list of values (or an error).
Here are all the functions but for EasierMYSQL.
database.create_Table()
database.select_values()
database.insert_values()
database.delete_table()
database.create_new_column()
database.delete_row()
database.rename_Table()
database.rename_Column()
database.attach_database()
database.detach_database()
database.delete_column()
database.show_tables()
database.execute_custom_query() # Returns the database, so you can execute Your own query, if the module doesn't support that type.
The execute_custom_query is as same as the One in EasierSQLLite.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
EasierSQL-0.1.2.tar.gz
(5.4 kB
view details)
Built Distribution
File details
Details for the file EasierSQL-0.1.2.tar.gz
.
File metadata
- Download URL: EasierSQL-0.1.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 243c95fc8879d1c7d1ebaa92ac027d133a2ff4f6069c1abf3f54960e4aef0918 |
|
MD5 | 575916cdfbd8032c90c02c63cc0bd0c8 |
|
BLAKE2b-256 | 82b6edce9aa6ae83a1c261f453927c5409f66d5c6a48e479dfd8110400baab3e |
File details
Details for the file EasierSQL-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: EasierSQL-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eb9f155f0ebe29a345e29cc48e76505967dbbffc822f0aa2062b8a72aa70435 |
|
MD5 | 18c160b77c5abcaf6222e0799d7e0d73 |
|
BLAKE2b-256 | 66e75c1d07280cfac524d4ef77dcfc76c39c89da25a2f81adecff0222d279180 |