Package: high-sql
High SQLAboutA high-level sql command utility. Currently, only MySQL is
supported.PYPI PackageTable of ContentsUsing the libraryInstalling and using the libraryExamples of usageManually install the libraryPrerequisitesInstall the requirementsRun the Unit TestsContinuous IntegrationUpdate PyPI packageLicenseUsing the libraryFor a detailed usage example seeexample.py.Installing and using the libraryFirst, you need to install the library using pip:$pipinstallhigh_sqlThen, import it and initialize it like so:fromhigh_sqlimportHighMySQLdb_conf={'hostname':'your hostname','username':'your username','password':'your password','db_name':'your db name','port':3306}mysql_obj=HighMySQL(config=db_conf)If you want to use a yml file to load the configuration, you can use theHighConfigclass:fromhigh_sqlimportHighConfigimportosconfig_path=str(os.path.join('confs','conf.yml'))config=HighConfig(config_src=config_path)db_conf=config.get_db_config()Two example YAML files can be found in
theconfs folder.
For more details on how to use this YAML configuration loader see
thisReadme.Examples of usageThe currently supported operations are the following:Inserts, Updates, Deletes, SelectCreate, Truncate, Drop tableShow all tablesInsertmysql_obj.insert_into_table('test_table',data={'firstname':'Mr Name','lastname':'surname'})Updatemysql_obj.update_table('test_table',set_data={'lastname':'New Last Name'},where='firstname="Mr Name"')Deletemysql_obj.delete_from_table('test_table',where='firstname="Mr Name"')Selectres=mysql_obj.select_from_table('test_table',columns='*',where='firstname="Mr Name"',order_by='firstname',asc_or_desc='ASC',limit=5)Truncatemysql_obj.truncate_table('test_table')Createmysql_obj.create_table(table='test_table',schema=table_schema)Dropmysql_obj.drop_table('test_table')Show Tablesmysql_obj.show_tables()All of these examples can be found
inexample.py.Manually install the libraryThese instructions will get you a copy of the project up and running on your local machine for
development and testing purposes.PrerequisitesYou need to have a machine withanacondainstalled and
any Bash based shell (e.g. zsh) installed.$ conda -V
conda 4.10.1

$ echo $SHELL
/usr/bin/zshInstall the requirementsAll the installation steps are being handled by
theMakefile.First, modify the python version (min_python) and everything else you need in
thesettings.ini.Then, execute the following commands:$ make create_env
$ conda activate yaml_config_wrapper
$ make distNow you are ready to use and modify the library.Run the Unit TestsIf you want to run the unit tests, execute the following command:$ make testsContinuous IntegrationFor the continuous integration, theCircleCIservice is being used. For more information you can
check thesetup guide.For any modifications, edit
thecircleci config.Update PyPI packageThis is mainly for future reference for the developers of this project. First,
create a file called~/.pypircwith your pypi login details, as follows:[pypi]
username = your_pypi_username
password = your_pypi_passwordThen, modify the python version (min_python), project status (status), release version (version)
and everything else you need in
thesettings.ini.Finally, execute the following commands:$ make create_env
$ conda activate yaml_config_wrapper
$ make releaseFor a dev release, change thetesting_versionand instead ofmake release, runmake release_test.LicenseThis project is licensed under the MIT License - see
theLICENSEfile for details.