pycarol.tools.data_model_generator¶
This tool helps to DataModels from json files.
-
class
pycarol.tools.data_model_generator.DataModelGenerator(carol)[source]¶ This class will create a Datamodel from a python dictionary. Today, it is not allowed nested fileds in the dictionary.
Usage:
from pycarol import PwdAuth from pycarol.carol import Carol from pycarol.utils.data_model_generator import DataModelGenerator json_sample = {'atende_sus': 'Sim', 'estabelecimento': 'Hospital Raimundo Chaar', 'existente': '42', 'tipo_do_estabelecimento': '05 - Hospital Geral', 'tipo_do_estabelecimento_resumo': 'Hospitais', 'uf': 'AC'} login = Carol('foo_tenant, 'foo', auth=PwdAuth('foo@totvs.com.br', 'foo123')) la = DataModelGenerator(login) la.start(json_sample, dm_name='hfair', profile_title='estabelecimento', publish=True, overwrite=True)
-
start(json_sample, dm_name, publish=True, profile_title=None, overwrite=False, vertical_ids=None, vertical_names='retail', entity_template_type_ids=None, entity_template_type_names='product', dm_label=None, group_name='Others', transaction_dm=False, ignore_field_type=False)[source]¶ Start the process.
Args:
- json_sample: dict
- Dictionary with key and values to be used as template for the data model
- dm_name: str
- Data model name
- publish: bool default True
- Publish the data model at the end.
- profile_title: list default None
- Carol’s Profile title. It should be an field in json_sample
- overwrite: bool default False
- Overwrite if the data model already exists
- vertical_ids: str default None
- Vertical ID for the data model. either vertical_ids
- vertical_names: str default retail
- Vertical Name for the data model. either vertical_ids
- entity_template_type_ids: str default None
- Data model template type id
- entity_template_type_names: str default product
- Data model template type name
- dm_label: str default None
- Label for the data model
- group_name: str default Others
- Group name for the data model
- transaction_dm: bool default False
- Transaction Data model
- ignore_field_type: bool default False
- Ignore filed type when creating the data model. It means that any type conflict will be ignored. pycarol will use the one that already exists.
- Returns:
- None
-