-
Notifications
You must be signed in to change notification settings - Fork 1
/
db_syncs.yml
63 lines (56 loc) · 2.53 KB
/
db_syncs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# This example workflow demonstrates how to sync tables from one database to another in a workflow.
#
# Workflows in the Civis Platform are written in YAML and a workflow DSL
# (domain specific language) called Mistral.
#
# See this website, https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html,
# for an introduction to YAML.
#
# See the Mistral documentation, https://docs.openstack.org/mistral/train/user/wf_lang_v2.html,
# for a description of the Mistral DSL.
#
# See the YAQL docs for more details, https://yaql.readthedocs.io/en/latest/.
version: "2.0"
workflow:
input:
# Your database credentials (can be found in Platform Credentials)
- source_database_credential_id: 11722
- destination_database_credential_id: 12345
# Source database parameters
- source_remote_host_id: 89 # The source database ID
- source_schema: "scratch" # The schema where source tables live
- source_tables: "source_table_1,source_table_2" # A comma-separated list of table names in `source_schema`
# Destination database parameters
- destination_remote_host_id: 32 # The destination database ID
- destination_schema: "scratch" # The schema where destination tables live
- destination_tables: "destination_table_1,destination_table_2" # A comma-separated list of table names in `destination_schema`
# NOTE: table names in `destination_tables` correspond element-wise to table names in `source_tables`
# e.g. "source_table_1" is synced to "destination_table_1"
tasks:
dbsync_test:
with-items: table_name in <% $.source_tables.split(",").zip($.destination_tables.split(",")) %>
action: civis.import
input:
name: DB Sync Test
sync_type: Dbsync
# Required
is_outbound: false
source:
credentialID: <% $.source_database_credential_id %>
remoteHostId: <% $.source_remote_host_id %>
destination:
credentialID: <% $.destination_database_credential_id %>
remoteHostId: <% $.destination_remote_host_id %>
# List of tables to be transferred
syncs:
- source:
databaseTable:
schema: <% $.source_schema %>
table: <% $.table_name[0] %>
destination:
databaseTable:
schema: <% $.destination_schema %>
table: <% $.table_name[1] %>
advanced_options:
# For a full list of advanced options, you can call a imports.get() on a specific db sync object
verifyTableRowCounts: true