-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Veeva Vault Objects example #56
base: main
Are you sure you want to change the base?
Conversation
|
README.md
Outdated
@@ -114,6 +114,10 @@ Refer to the Multithreading Guidelines in api_threading_utils.py | |||
This is an example of how we can sync Smartsheets sheets via Connector SDK. | |||
You would need to provide your Smartsheets api_key for this example to work. | |||
|
|||
### veeva vault objects | |||
This is an example of how we can sync Veeva Vault Object data using VQL via Connector SDK. | |||
You would need to provide your Veeva Vault vaultDNS, username, and password for this example to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would need to provide your Veeva Vault vaultDNS, username, and password for this example to work. | |
You would need to provide your Veeva Vault credentials for this example to work. |
examples/source_examples/veeva_vault_objects/configuration.json
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,171 @@ | |||
# This is a simple example for how to work with the fivetran_connector_sdk module. | |||
# This code is currently configured to Retrieve Details from All Object Types in Veeva Vault and then utilize VQL to retrieve all Object records, creating 1 table per object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# This code is currently configured to Retrieve Details from All Object Types in Veeva Vault and then utilize VQL to retrieve all Object records, creating 1 table per object | |
# This code is currently configured to Retrieve Details from All Object Types in Veeva Vault and then utilize VQL to retrieve all Object records, creating one table per object |
@@ -0,0 +1,171 @@ | |||
# This is a simple example for how to work with the fivetran_connector_sdk module. | |||
# This code is currently configured to Retrieve Details from All Object Types in Veeva Vault and then utilize VQL to retrieve all Object records, creating 1 table per object | |||
# You will need to provide your own Veeva Vault credentials for this to work --> vaultDNS, username, and password variables in configuration.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# You will need to provide your own Veeva Vault credentials for this to work --> vaultDNS, username, and password variables in configuration.json | |
# You will need to provide your own Veeva Vault credentials for this to work --> subdomain, username, and password variables in configuration.json |
# You will need to provide your own Veeva Vault credentials for this to work --> vaultDNS, username, and password variables in configuration.json | ||
# Retrieve Details from All Object Types endpoint: https://developer.veevavault.com/api/24.2/#retrieve-details-from-all-object-types | ||
# VQL endpoint: https://developer.veevavault.com/api/24.2/#vault-query-language-vql | ||
# Can also add code to extract from other endpoints as needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Can also add code to extract from other endpoints as needed | |
# You can also add code to extract from other endpoints as needed. |
log.severe(f"Failed to create session for user with username: {username}") | ||
session_id = None | ||
else: | ||
log.severe(f"Failed to get 200 response from Auth URL: {auth_url}, received response status code of {response.status_code}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish this log statement, and also throw the response.message, so that error is visible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work? "Authentication failed: {auth_url} returned {response.status_code}. Expected 200."
# The state dictionary is empty for the first sync or for any full re-sync | ||
# This function is designed to loop through and retrieve vault Object data using VQL endpoint: https://developer.veevavault.com/api/24.2/#submitting-a-query | ||
def update(configuration: dict, state: dict): | ||
base_url = f"https://{configuration.get('vaultDNS')}/api/v24.2/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define this as a constant and then use that for all occurrences
you can keep some regex and then replace that while using in your code with config value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defined as a constant at the start of the code under #Constant
@orizwanft please re-request the review in future, so we can get notified to review the PR again 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there 🙌🏻
def startVeevaSession(configuration: dict): | ||
username = configuration.get('username') | ||
password = configuration.get('password') | ||
auth_url = f"https://{configuration.get('subdomain')}/api/v24.2/auth" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are calling the field as sub-domain but then taking the entire value in credentials as the URL
it should be
auth_url = f"https://{configuration.get('subdomain')}.veevavault.com/api/v24.2/auth"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
# - session_id: a Veeva Vault session ID generated from the startVeevaSession function | ||
|
||
def endVeevaSession(configuration: dict, session_id): | ||
deactivate_session_url = f"https://{configuration.get('subdomain')}/api/v24.2/session" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
# - session_id: a Veeva Vault session ID generated from the startVeevaSession function | ||
|
||
def getVaultObjects(configuration: dict, session_id): | ||
base_url = f"https://{configuration.get('subdomain')}/api/v24.2/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
def initialize_sync(configuration: dict, state: dict): | ||
|
||
sub_domain = configuration.get('subdomain') | ||
base_url = f"https://{sub_domain}/api/v24.2/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
No description provided.