Source code for module.lesson_1_entities

from dotenv import find_dotenv, load_dotenv
import avesterra as av
import orchestra.env as env
from utils import create_company_entity, create_person_entity


[docs] def main(): # Initialize connection to AvesTerra server at IP Address load_dotenv(find_dotenv()) host = env.get_or_raise("AVESTERRA_HOST") cert_dir = env.get_or_raise("AVESTERRA_CERTIFICATE_DIR_PATH") auth = env.get_or_raise("AVESTERRA_AUTH", av.AvAuthorization) av.initialize(server=host, directory=cert_dir, socket_count=2) # Create people john_entity = create_person_entity.create_entity("John Smith", auth=auth) jane_entity = create_person_entity.create_entity("Jane Smith", auth=auth) # Create companies ibm_entity = create_company_entity.create_company("IBM", auth=auth) amazon_entity = create_company_entity.create_company("AMAZON", auth=auth) print("----------------Lookup these Entity IDs in Maestro or avu ----------------") print(f"John_entity: {john_entity}") print(f"Jane_entity: {jane_entity}") print(f"ibm_entity: {ibm_entity}") print(f"amazon_entity: {amazon_entity}") print("------------------------------------------------------------------") av.finalize()
if __name__ == "__main__": main()