-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
22 changed files
with
280 additions
and
4,328 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
template/kafka-environment/flink-statements/create-combined-customer-record.sql
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,27 @@ | ||
INSERT INTO `demo.customers.golden` | ||
SELECT | ||
CAST(idm.id AS BYTES) AS key, | ||
|
||
IFNULL (sa.first_name, SPLIT_INDEX(sb.name, ' ', 0)) AS first_name, | ||
IFNULL (sa.last_name, SPLIT_INDEX(sb.name, ' ', 1)) AS last_name, | ||
sb.birthday AS date_of_birth, | ||
IFNULL (sa.email, sb.email_address) AS email, | ||
IFNULL (sa.phone, sb.contact_number) AS phone, | ||
sa.address AS address, | ||
|
||
CASE | ||
WHEN sa.loyalty_tier = 'diamond' THEN sa.loyalty_tier | ||
WHEN sb.membership_level = 'gold' THEN 'diamond' | ||
WHEN sa.loyalty_tier = 'sapphire' THEN sa.loyalty_tier | ||
ELSE 'emerald' | ||
END AS loyalty_tier, | ||
|
||
IFNULL(sa.loyalty_points, 0) + (IFNULL(sb.membership_points, 0) * 5) AS loyalty_points, | ||
sb.favorite_drink AS favorite_drink, | ||
CAST(sa.key AS STRING) AS system_a_customer_id, | ||
CAST(sb.key AS STRING) AS system_b_customer_id, | ||
IFNULL(sa.last_modified_date, sb.last_modified_date) AS last_modified_date | ||
|
||
FROM `demo.customers.id-mapping` AS idm | ||
JOIN `demo.customers.system-a` AS sa ON idm.aCustomerID = CAST(sa.key AS STRING) | ||
JOIN `demo.customers.system-b` AS sb ON idm.bCustomerID = CAST(sb.key AS STRING) |
9 changes: 0 additions & 9 deletions
9
template/kafka-environment/flink-statements/sample-query-customer-order-aggregate.sql
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
template/kafka-environment/flink-statements/sample-query-order-item-customer-join.sql
This file was deleted.
Oops, something went wrong.
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,36 @@ | ||
resource "confluent_flink_statement" "random_int_table" { | ||
organization { | ||
id = data.confluent_organization.this.id | ||
} | ||
environment { | ||
id = module.staging_environment.id | ||
} | ||
compute_pool { | ||
id = module.customer_cluster.flink_compute_pool_id | ||
} | ||
principal { | ||
id = module.customer_cluster.developer_write_service_account.id | ||
} | ||
statement = file("./flink-statements/create-combined-customer-record.sql") | ||
statement_name = "create-customer-golden-record" | ||
|
||
properties = { | ||
# SET TABLE 'staging'; | ||
"sql.current-catalog" = module.staging_environment.confluent_environment.display_name | ||
# SET DATABASE 'inventory'; | ||
"sql.current-database" = module.customer_cluster.confluent_kafka_cluster.display_name | ||
} | ||
|
||
rest_endpoint = module.customer_cluster.flink_rest_endpoint | ||
credentials { | ||
key = module.customer_cluster.flink_admin_api_key.id | ||
secret = module.customer_cluster.flink_admin_api_key.secret | ||
} | ||
|
||
depends_on = [ | ||
module.customers_a_topic, | ||
module.customers_b_topic, | ||
module.customers_mapping_topic, | ||
module.customers_golden_topic | ||
] | ||
} |
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
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
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
Oops, something went wrong.