This is a package for sharing common crud operation to profile schema in the db
Project description
Installation and upgrade
To install this package run "pip install profile-local". To upgrade this package run "pip install --upgrade profile-local".
Import
from profile_local.generic_profile_insert import generic_profile_insert
Use example
data = { 'location': LOCATION_DATA, 'profile': PROFILE_DATA, 'storage': STORAGE_DATA, 'reaction': REACTION_DATA, 'operational_hours': OPERATIONAL_HOURS }
Where LOCATION_DATA, PROFILE_DATA, STORAGE_DATA, REACTION_DATA, OPERATIONAL_HOURS are dictionaries with the relevant data for the table i.e. for profile_table: PROFILE_DATA = { 'profile_name': NAME, 'name_approved': NAME_APPROVED, 'lang_code': LANG_CODE, 'user_id': USER_ID, # Optional 'is_main': IS_MAIN, # Optional 'visibility_id': VISIBILITY_ID, 'is_approved': IS_APPROVED, 'profile_type_id': PROFILE_TYPE_ID, # Optional 'preferred_lang_code': PREFERRED_LANG_CODE, # Optional 'experience_years_min': EXPERIENCE_YEARS_MIN, # Optional 'main_phone_id': MAIN_PHONE_ID, # Optional 'rip': RIP, # Optional 'gender_id': GENDER_ID, # Optional 'stars': STARS, 'last_dialog_workflow_state_id': LAST_DIALOG_WORKFLOW_STATE_ID }
Then call json.dumps: data_json=json.dumps(data)
Now we can call the generic_profile_insert function: profile_id = generic_profile_insert(data_json)
If the function inserted a profile successfully it returns the profile_id of the inserted profile. The function doesn't have to always insert a profile, for example you can use it to insert only a location with data = { 'location': LOCATION_DATA, }
and then the returned profile_id will be 'None'.
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
Built Distribution
Hashes for profile_local-0.0.37-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81d318aad46b31e7687873585fcb1d57ff680f16ebb0d54dbf5230aa4ba93a0f |
|
MD5 | 3321fa7e7bb48f5f349358dcb350d7d1 |
|
BLAKE2b-256 | de7fd0aa5a21a84b9fa06fa0cb7dc004f304b42114ef88013c28eccb66aa0869 |