Skip to content

Commit

Permalink
Add cohort to partition_keys of Glue tables
Browse files Browse the repository at this point in the history
  • Loading branch information
philerooski committed Sep 1, 2023
1 parent 5cd8b76 commit f186062
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
96 changes: 96 additions & 0 deletions src/glue/resources/table_columns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
HealthKitV2Statistics:
columns:
- Name: HealthKitStatisticKey
Expand All @@ -61,6 +64,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
HealthKitV2Samples:
columns:
- Name: HealthKitSampleKey
Expand Down Expand Up @@ -91,6 +97,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
HealthKitV2Samples_Deleted:
columns:
- Name: HealthKitSampleKey
Expand All @@ -105,6 +114,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
HealthKitV2ActivitySummaries:
columns:
- Name: HealthKitActivitySummaryKey
Expand Down Expand Up @@ -135,6 +147,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
HealthKitV2Electrocardiogram:
columns:
- Name: HealthKitECGSampleKey
Expand Down Expand Up @@ -171,6 +186,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
HealthKitV2Workouts:
columns:
- Name: HealthKitWorkoutKey
Expand Down Expand Up @@ -199,6 +217,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
HealthKitV2Heartbeat:
columns:
- Name: HealthKitHeartbeatSampleKey
Expand All @@ -225,6 +246,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
FitbitActivityLogs:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -273,6 +297,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
FitbitDevices:
columns:
- Name: ParticipantIdentifier
Expand All @@ -291,6 +318,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
FitbitDailyData:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -359,6 +389,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
FitbitIntradayCombined:
columns:
- Name: ParticipantID
Expand Down Expand Up @@ -397,6 +430,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
FitbitRestingHeartRates:
columns:
- Name: ParticipantIdentifier
Expand All @@ -411,6 +447,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
FitbitSleepLogs:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -461,6 +500,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GoogleFitSamples:
columns:
- Name: GoogleFitSampleKey
Expand Down Expand Up @@ -505,6 +547,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
SymptomLog:
columns:
- Name: DatapointKey
Expand All @@ -525,6 +570,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminActivityDetailsSummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -553,6 +601,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminActivitySummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -661,6 +712,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminBloodPressureSummary:
columns:
- Name: ParticipantIdentifier
Expand All @@ -687,6 +741,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminBodyCompositionSummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -717,6 +774,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminDailySummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -789,6 +849,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminEpochSummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -827,6 +890,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminHealthSnapshotSummary:
columns:
- Name: ParticipantIdentifier
Expand All @@ -851,6 +917,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminHrvSummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -879,6 +948,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminManuallyUpdatedActivitySummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -951,6 +1023,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminMoveIQActivitySummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -981,6 +1056,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminPulseOxSummary:
columns:
- Name: ParticipantIdentifier
Expand All @@ -1007,6 +1085,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminRespirationSummary:
columns:
- Name: ParticipantIdentifier
Expand All @@ -1029,6 +1110,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminSleepSummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -1075,6 +1159,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminStressDetailSummary:
columns:
- Name: ParticipantIdentifier
Expand All @@ -1101,6 +1188,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminThirdPartyDailySummary:
columns:
- Name: ParticipantIdentifier
Expand Down Expand Up @@ -1149,6 +1239,9 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
GarminUserMetricsSummary:
columns:
- Name: ParticipantIdentifier
Expand All @@ -1171,3 +1264,6 @@ tables:
Type: string
- Name: export_end_date
Type: string
partition_keys:
- Name: cohort
Type: string
2 changes: 2 additions & 0 deletions templates/glue-tables.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Resources:
{% do dataset.update({'table_name': 'dataset_' + v.lower()})%}
{% set schema = sceptre_user_data.dataset_schemas.tables[v] %}
{% do dataset.update({'columns': schema['columns']}) %}
{% do dataset.update({'partition_keys': schema['partition_keys']}) %}
{% do dataset.update({'stackname_prefix': '{}'.format(v.replace('_',''))}) %}
{% do datasets.append(dataset) %}
{% endfor %}
Expand All @@ -53,6 +54,7 @@ Resources:
compressionType: none
typeOfData: file
Retention: 0
PartitionKeys: {{ dataset.partition_keys }}
StorageDescriptor:
Columns: {{ dataset.columns }}
Compressed: false
Expand Down

0 comments on commit f186062

Please sign in to comment.