basacommons-0.0.9


توضیحات

Basic project utilities
ویژگی مقدار
سیستم عامل -
نام فایل basacommons-0.0.9
نام basacommons
نسخه کتابخانه 0.0.9
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Enrique Basañez Mercader
ایمیل نویسنده enrique.basanez@gmail.com
آدرس صفحه اصلی https://github.com/ebasanez/python-commons
آدرس اینترنتی https://pypi.org/project/basacommons/
مجوز -
This project joins some useful scripts designed to speed up project development. Main scripts are: ## configuration.py This script generates a configparser.configuration instance. Configuration load from different sources: ### AWS Systems manager parameter store * Given that AWS CLI is configured and credentials loaded ```python configuration = load_config('ssm',environment) ``` SSM variable key must have format: /$environment/$section and value in json format Key | Value --- | --- /pre/ddbb | {"host":"localhost","port":3306,"username":"root","password":"changeit"} #### Local file ```python configuration = load_config('file',environment, file_name) ``` File expected in standard INI file structure. ``` [ddbb] host=localhost port=3306 username=root password=changeit ``` #### Environment variables. ```python configuration = load_config('env',environment, projectname) ``` Variables should have the following format: $projectname_$environemnt_$sectionname ``` MYPROJECT_PRO_DDBB_HOST=localhost MYPROJECT_PRO_DDBB_PORT=3306 MYPROJECT_PRO_DDBB_USERNAME=root MYPROJECT_PRO_DDBB_PASSWORD=changeit ``` ### Database.py Database connection and query execution ```python database = Database.ofConfiguration(configuration) ``` To execute query, use method *Database.run_query* ```python records = database.run_query('SELECT * FROM table WHERE mycolumn = %s AND myothercolumn = '%s',('value1', 'value2' )) ``` Pagination is supported using class *database.Page*: ```python page_number = 1 page_size = 50 page = Database.Page(page_number, page_size) records = database.run_query('SELECT * FROM table WHERE mycolumn = %s AND myothercolumn = '%s', ('value1', 'value2' ), page) ``` ### alerts.py Alert sending, via AWS simple email service.


زبان مورد نیاز

مقدار نام
>=3.7 Python


نحوه نصب


نصب پکیج whl basacommons-0.0.9:

    pip install basacommons-0.0.9.whl


نصب پکیج tar.gz basacommons-0.0.9:

    pip install basacommons-0.0.9.tar.gz