-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1259974
commit a378d51
Showing
7 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from dotenv import load_dotenv | ||
import os | ||
from prefect_fivetran import FivetranCredentials | ||
|
||
load_dotenv() | ||
|
||
fivetran_credentials = FivetranCredentials( | ||
api_key=os.environ.get("FIVETRAN_API_KEY"), | ||
api_secret=os.environ.get("FIVETRAN_API_SECRET_KEY"), | ||
) | ||
fivetran_credentials.save("default") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from prefect import flow, Task | ||
from prefect_fivetran import FivetranCredentials | ||
from prefect_fivetran.connectors import fivetran_sync_flow | ||
|
||
|
||
@flow | ||
def my_flow(): | ||
fivetran_result = await fivetran_sync_flow( | ||
fivetran_credentials=FivetranCredentials.load("default"), | ||
connector_id="my_connector_id", | ||
schedule_type="my_schedule_type", | ||
poll_status_every_n_seconds=30, | ||
) | ||
|
||
|
||
my_flow() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
pip install prefect_fivetran | ||
prefect block register -m prefect_fivetran | ||
""" | ||
from prefect import flow | ||
from prefect_fivetran import FivetranCredentials | ||
from prefect_fivetran.connectors import ( | ||
wait_for_fivetran_connector_sync, | ||
start_fivetran_connector_sync, | ||
) | ||
|
||
|
||
@flow | ||
def example_flow(connector_id: str): | ||
fivetran_credentials = FivetranCredentials.load("default") | ||
|
||
last_sync = start_fivetran_connector_sync( | ||
connector_id=connector_id, | ||
fivetran_credentials=fivetran_credentials, | ||
) | ||
|
||
return wait_for_fivetran_connector_sync( | ||
connector_id=connector_id, | ||
fivetran_credentials=fivetran_credentials, | ||
previous_completed_at=last_sync, | ||
poll_status_every_n_seconds=60, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
example_flow("bereft_indices") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
prefect | ||
prefect_fivetran |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"type": "service_account", | ||
"project_id": "xxx", | ||
"private_key_id": "xxx", | ||
"private_key": "xxx", | ||
"client_email": "generic@xxx.iam.gserviceaccount.com", | ||
"client_id": "xxx", | ||
"project_id": "prefect-community", | ||
"private_key_id": "uuid", | ||
"private_key": "-----BEGIN PRIVATE KEY-----\n a looooooong string", | ||
"client_email": "prefect@prefect-community.iam.gserviceaccount.com", | ||
"client_id": "numbers", | ||
"auth_uri": "https://accounts.google.com/o/oauth2/auth", | ||
"token_uri": "https://oauth2.googleapis.com/token", | ||
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", | ||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/generic%40prefect-community.iam.gserviceaccount.com" | ||
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/sa_name_and_project_name.iam.gserviceaccount.com" | ||
} |