Skip to main content

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_JSON, 'operational_hours': OPERATIONAL_HOURS }

Where LOCATION_DATA, PROFILE_DATA, STORAGE_DATA, REACTION_JSON, 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

profile-local-0.0.39.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

profile_local-0.0.39-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page