A wrapper for SQLite, Most of the queries wrapped into commands for ease.
Project description
Installation
pip install EasierSQL
EasySQLite code examples -:
Before you proceed, make sure you know Some real SQL, before looking at the code, otherwise you probably won't understand anything.
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.
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.0.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for EasierSQL-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df3a55c554203624f42801594a865916be00e38c3e2ee1cf4c6b79b25e18e083 |
|
MD5 | e8a274ebbe47bab8cc053d173a9e94c5 |
|
BLAKE2b-256 | c86f174efc22527b7450f534629471e9fbc4d1e0fb5aa9cc2eca8bd72ebd86ae |