-
Notifications
You must be signed in to change notification settings - Fork 455
/
OMOPCDM_redshift_5.4_ddl.sql
511 lines (511 loc) · 19.6 KB
/
OMOPCDM_redshift_5.4_ddl.sql
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
--redshift CDM DDL Specification for OMOP Common Data Model 5.4
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.person ( person_id integer NOT NULL,
gender_concept_id integer NOT NULL,
year_of_birth integer NOT NULL,
month_of_birth integer NULL,
day_of_birth integer NULL,
birth_datetime TIMESTAMP NULL,
race_concept_id integer NOT NULL,
ethnicity_concept_id integer NOT NULL,
location_id integer NULL,
provider_id integer NULL,
care_site_id integer NULL,
person_source_value varchar(50) NULL,
gender_source_value varchar(50) NULL,
gender_source_concept_id integer NULL,
race_source_value varchar(50) NULL,
race_source_concept_id integer NULL,
ethnicity_source_value varchar(50) NULL,
ethnicity_source_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.observation_period (observation_period_id integer NOT NULL,
person_id integer NOT NULL,
observation_period_start_date date NOT NULL,
observation_period_end_date date NOT NULL,
period_type_concept_id integer NOT NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.visit_occurrence (visit_occurrence_id integer NOT NULL,
person_id integer NOT NULL,
visit_concept_id integer NOT NULL,
visit_start_date date NOT NULL,
visit_start_datetime TIMESTAMP NULL,
visit_end_date date NOT NULL,
visit_end_datetime TIMESTAMP NULL,
visit_type_concept_id Integer NOT NULL,
provider_id integer NULL,
care_site_id integer NULL,
visit_source_value varchar(50) NULL,
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
discharged_to_source_value varchar(50) NULL,
preceding_visit_occurrence_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.visit_detail (visit_detail_id integer NOT NULL,
person_id integer NOT NULL,
visit_detail_concept_id integer NOT NULL,
visit_detail_start_date date NOT NULL,
visit_detail_start_datetime TIMESTAMP NULL,
visit_detail_end_date date NOT NULL,
visit_detail_end_datetime TIMESTAMP NULL,
visit_detail_type_concept_id integer NOT NULL,
provider_id integer NULL,
care_site_id integer NULL,
visit_detail_source_value varchar(50) NULL,
visit_detail_source_concept_id Integer NULL,
admitted_from_concept_id Integer NULL,
admitted_from_source_value varchar(50) NULL,
discharged_to_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id integer NOT NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.condition_occurrence (condition_occurrence_id integer NOT NULL,
person_id integer NOT NULL,
condition_concept_id integer NOT NULL,
condition_start_date date NOT NULL,
condition_start_datetime TIMESTAMP NULL,
condition_end_date date NULL,
condition_end_datetime TIMESTAMP NULL,
condition_type_concept_id integer NOT NULL,
condition_status_concept_id integer NULL,
stop_reason varchar(20) NULL,
provider_id integer NULL,
visit_occurrence_id integer NULL,
visit_detail_id integer NULL,
condition_source_value varchar(50) NULL,
condition_source_concept_id integer NULL,
condition_status_source_value varchar(50) NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.drug_exposure (drug_exposure_id integer NOT NULL,
person_id integer NOT NULL,
drug_concept_id integer NOT NULL,
drug_exposure_start_date date NOT NULL,
drug_exposure_start_datetime TIMESTAMP NULL,
drug_exposure_end_date date NOT NULL,
drug_exposure_end_datetime TIMESTAMP NULL,
verbatim_end_date date NULL,
drug_type_concept_id integer NOT NULL,
stop_reason varchar(20) NULL,
refills integer NULL,
quantity float NULL,
days_supply integer NULL,
sig varchar(MAX) NULL,
route_concept_id integer NULL,
lot_number varchar(50) NULL,
provider_id integer NULL,
visit_occurrence_id integer NULL,
visit_detail_id integer NULL,
drug_source_value varchar(50) NULL,
drug_source_concept_id integer NULL,
route_source_value varchar(50) NULL,
dose_unit_source_value varchar(50) NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.procedure_occurrence (procedure_occurrence_id integer NOT NULL,
person_id integer NOT NULL,
procedure_concept_id integer NOT NULL,
procedure_date date NOT NULL,
procedure_datetime TIMESTAMP NULL,
procedure_end_date date NULL,
procedure_end_datetime TIMESTAMP NULL,
procedure_type_concept_id integer NOT NULL,
modifier_concept_id integer NULL,
quantity integer NULL,
provider_id integer NULL,
visit_occurrence_id integer NULL,
visit_detail_id integer NULL,
procedure_source_value varchar(50) NULL,
procedure_source_concept_id integer NULL,
modifier_source_value varchar(50) NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.device_exposure (device_exposure_id integer NOT NULL,
person_id integer NOT NULL,
device_concept_id integer NOT NULL,
device_exposure_start_date date NOT NULL,
device_exposure_start_datetime TIMESTAMP NULL,
device_exposure_end_date date NULL,
device_exposure_end_datetime TIMESTAMP NULL,
device_type_concept_id integer NOT NULL,
unique_device_id varchar(255) NULL,
production_id varchar(255) NULL,
quantity integer NULL,
provider_id integer NULL,
visit_occurrence_id integer NULL,
visit_detail_id integer NULL,
device_source_value varchar(50) NULL,
device_source_concept_id integer NULL,
unit_concept_id integer NULL,
unit_source_value varchar(50) NULL,
unit_source_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.measurement (measurement_id integer NOT NULL,
person_id integer NOT NULL,
measurement_concept_id integer NOT NULL,
measurement_date date NOT NULL,
measurement_datetime TIMESTAMP NULL,
measurement_time varchar(10) NULL,
measurement_type_concept_id integer NOT NULL,
operator_concept_id integer NULL,
value_as_number float NULL,
value_as_concept_id integer NULL,
unit_concept_id integer NULL,
range_low float NULL,
range_high float NULL,
provider_id integer NULL,
visit_occurrence_id integer NULL,
visit_detail_id integer NULL,
measurement_source_value varchar(50) NULL,
measurement_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
unit_source_concept_id integer NULL,
value_source_value varchar(50) NULL,
measurement_event_id integer NULL,
meas_event_field_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.observation (observation_id integer NOT NULL,
person_id integer NOT NULL,
observation_concept_id integer NOT NULL,
observation_date date NOT NULL,
observation_datetime TIMESTAMP NULL,
observation_type_concept_id integer NOT NULL,
value_as_number float NULL,
value_as_string varchar(60) NULL,
value_as_concept_id Integer NULL,
qualifier_concept_id integer NULL,
unit_concept_id integer NULL,
provider_id integer NULL,
visit_occurrence_id integer NULL,
visit_detail_id integer NULL,
observation_source_value varchar(50) NULL,
observation_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
qualifier_source_value varchar(50) NULL,
value_source_value varchar(50) NULL,
observation_event_id integer NULL,
obs_event_field_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.death ( person_id integer NOT NULL,
death_date date NOT NULL,
death_datetime TIMESTAMP NULL,
death_type_concept_id integer NULL,
cause_concept_id integer NULL,
cause_source_value varchar(50) NULL,
cause_source_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.note (note_id integer NOT NULL,
person_id integer NOT NULL,
note_date date NOT NULL,
note_datetime TIMESTAMP NULL,
note_type_concept_id integer NOT NULL,
note_class_concept_id integer NOT NULL,
note_title varchar(250) NULL,
note_text varchar(MAX) NOT NULL,
encoding_concept_id integer NOT NULL,
language_concept_id integer NOT NULL,
provider_id integer NULL,
visit_occurrence_id integer NULL,
visit_detail_id integer NULL,
note_source_value varchar(50) NULL,
note_event_id integer NULL,
note_event_field_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.note_nlp (note_nlp_id integer NOT NULL,
note_id integer NOT NULL,
section_concept_id integer NULL,
snippet varchar(250) NULL,
"offset" varchar(50) NULL,
lexical_variant varchar(250) NOT NULL,
note_nlp_concept_id integer NULL,
note_nlp_source_concept_id integer NULL,
nlp_system varchar(250) NULL,
nlp_date date NOT NULL,
nlp_datetime TIMESTAMP NULL,
term_exists varchar(1) NULL,
term_temporal varchar(50) NULL,
term_modifiers varchar(2000) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.specimen (specimen_id integer NOT NULL,
person_id integer NOT NULL,
specimen_concept_id integer NOT NULL,
specimen_type_concept_id integer NOT NULL,
specimen_date date NOT NULL,
specimen_datetime TIMESTAMP NULL,
quantity float NULL,
unit_concept_id integer NULL,
anatomic_site_concept_id integer NULL,
disease_status_concept_id integer NULL,
specimen_source_id varchar(50) NULL,
specimen_source_value varchar(50) NULL,
unit_source_value varchar(50) NULL,
anatomic_site_source_value varchar(50) NULL,
disease_status_source_value varchar(50) NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.fact_relationship (domain_concept_id_1 integer NOT NULL,
fact_id_1 integer NOT NULL,
domain_concept_id_2 integer NOT NULL,
fact_id_2 integer NOT NULL,
relationship_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.location (location_id integer NOT NULL,
address_1 varchar(50) NULL,
address_2 varchar(50) NULL,
city varchar(50) NULL,
state varchar(2) NULL,
zip varchar(9) NULL,
county varchar(20) NULL,
location_source_value varchar(50) NULL,
country_concept_id integer NULL,
country_source_value varchar(80) NULL,
latitude float NULL,
longitude float NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.care_site (care_site_id integer NOT NULL,
care_site_name varchar(255) NULL,
place_of_service_concept_id integer NULL,
location_id integer NULL,
care_site_source_value varchar(50) NULL,
place_of_service_source_value varchar(50) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.provider (provider_id integer NOT NULL,
provider_name varchar(255) NULL,
npi varchar(20) NULL,
dea varchar(20) NULL,
specialty_concept_id integer NULL,
care_site_id integer NULL,
year_of_birth integer NULL,
gender_concept_id integer NULL,
provider_source_value varchar(50) NULL,
specialty_source_value varchar(50) NULL,
specialty_source_concept_id integer NULL,
gender_source_value varchar(50) NULL,
gender_source_concept_id integer NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.payer_plan_period (payer_plan_period_id integer NOT NULL,
person_id integer NOT NULL,
payer_plan_period_start_date date NOT NULL,
payer_plan_period_end_date date NOT NULL,
payer_concept_id integer NULL,
payer_source_value varchar(50) NULL,
payer_source_concept_id integer NULL,
plan_concept_id integer NULL,
plan_source_value varchar(50) NULL,
plan_source_concept_id integer NULL,
sponsor_concept_id integer NULL,
sponsor_source_value varchar(50) NULL,
sponsor_source_concept_id integer NULL,
family_source_value varchar(50) NULL,
stop_reason_concept_id integer NULL,
stop_reason_source_value varchar(50) NULL,
stop_reason_source_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.cost (cost_id integer NOT NULL,
cost_event_id integer NOT NULL,
cost_domain_id varchar(20) NOT NULL,
cost_type_concept_id integer NOT NULL,
currency_concept_id integer NULL,
total_charge float NULL,
total_cost float NULL,
total_paid float NULL,
paid_by_payer float NULL,
paid_by_patient float NULL,
paid_patient_copay float NULL,
paid_patient_coinsurance float NULL,
paid_patient_deductible float NULL,
paid_by_primary float NULL,
paid_ingredient_cost float NULL,
paid_dispensing_fee float NULL,
payer_plan_period_id integer NULL,
amount_allowed float NULL,
revenue_code_concept_id integer NULL,
revenue_code_source_value varchar(50) NULL,
drg_concept_id integer NULL,
drg_source_value varchar(3) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.drug_era (drug_era_id integer NOT NULL,
person_id integer NOT NULL,
drug_concept_id integer NOT NULL,
drug_era_start_date date NOT NULL,
drug_era_end_date date NOT NULL,
drug_exposure_count integer NULL,
gap_days integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.dose_era (dose_era_id integer NOT NULL,
person_id integer NOT NULL,
drug_concept_id integer NOT NULL,
unit_concept_id integer NOT NULL,
dose_value float NOT NULL,
dose_era_start_date date NOT NULL,
dose_era_end_date date NOT NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.condition_era (condition_era_id integer NOT NULL,
person_id integer NOT NULL,
condition_concept_id integer NOT NULL,
condition_era_start_date date NOT NULL,
condition_era_end_date date NOT NULL,
condition_occurrence_count integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.episode (episode_id integer NOT NULL,
person_id integer NOT NULL,
episode_concept_id integer NOT NULL,
episode_start_date date NOT NULL,
episode_start_datetime TIMESTAMP NULL,
episode_end_date date NULL,
episode_end_datetime TIMESTAMP NULL,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id integer NOT NULL,
episode_type_concept_id integer NOT NULL,
episode_source_value varchar(50) NULL,
episode_source_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.episode_event (episode_id integer NOT NULL,
event_id integer NOT NULL,
episode_event_field_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.metadata (metadata_id integer NOT NULL,
metadata_concept_id integer NOT NULL,
metadata_type_concept_id integer NOT NULL,
name varchar(250) NOT NULL,
value_as_string varchar(250) NULL,
value_as_concept_id integer NULL,
value_as_number float NULL,
metadata_date date NULL,
metadata_datetime TIMESTAMP NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.cdm_source (cdm_source_name varchar(255) NOT NULL,
cdm_source_abbreviation varchar(25) NOT NULL,
cdm_holder varchar(255) NOT NULL,
source_description varchar(MAX) NULL,
source_documentation_reference varchar(255) NULL,
cdm_etl_reference varchar(255) NULL,
source_release_date date NOT NULL,
cdm_release_date date NOT NULL,
cdm_version varchar(10) NULL,
cdm_version_concept_id integer NOT NULL,
vocabulary_version varchar(20) NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.concept (concept_id integer NOT NULL,
concept_name varchar(255) NOT NULL,
domain_id varchar(20) NOT NULL,
vocabulary_id varchar(20) NOT NULL,
concept_class_id varchar(20) NOT NULL,
standard_concept varchar(1) NULL,
concept_code varchar(50) NOT NULL,
valid_start_date date NOT NULL,
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.vocabulary (vocabulary_id varchar(20) NOT NULL,
vocabulary_name varchar(255) NOT NULL,
vocabulary_reference varchar(255) NULL,
vocabulary_version varchar(255) NULL,
vocabulary_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.domain (domain_id varchar(20) NOT NULL,
domain_name varchar(255) NOT NULL,
domain_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.concept_class (concept_class_id varchar(20) NOT NULL,
concept_class_name varchar(255) NOT NULL,
concept_class_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.concept_relationship (concept_id_1 integer NOT NULL,
concept_id_2 integer NOT NULL,
relationship_id varchar(20) NOT NULL,
valid_start_date date NOT NULL,
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.relationship (relationship_id varchar(20) NOT NULL,
relationship_name varchar(255) NOT NULL,
is_hierarchical varchar(1) NOT NULL,
defines_ancestry varchar(1) NOT NULL,
reverse_relationship_id varchar(20) NOT NULL,
relationship_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.concept_synonym (concept_id integer NOT NULL,
concept_synonym_name varchar(1000) NOT NULL,
language_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.concept_ancestor (ancestor_concept_id integer NOT NULL,
descendant_concept_id integer NOT NULL,
min_levels_of_separation integer NOT NULL,
max_levels_of_separation integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.source_to_concept_map (source_code varchar(50) NOT NULL,
source_concept_id integer NOT NULL,
source_vocabulary_id varchar(20) NOT NULL,
source_code_description varchar(255) NULL,
target_concept_id integer NOT NULL,
target_vocabulary_id varchar(20) NOT NULL,
valid_start_date date NOT NULL,
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.drug_strength (drug_concept_id integer NOT NULL,
ingredient_concept_id integer NOT NULL,
amount_value float NULL,
amount_unit_concept_id integer NULL,
numerator_value float NULL,
numerator_unit_concept_id integer NULL,
denominator_value float NULL,
denominator_unit_concept_id integer NULL,
box_size integer NULL,
valid_start_date date NOT NULL,
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.cohort (cohort_definition_id integer NOT NULL,
subject_id integer NOT NULL,
cohort_start_date date NOT NULL,
cohort_end_date date NOT NULL )
DISTKEY(subject_id);
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.cohort_definition (cohort_definition_id integer NOT NULL,
cohort_definition_name varchar(255) NOT NULL,
cohort_definition_description varchar(MAX) NULL,
definition_type_concept_id integer NOT NULL,
cohort_definition_syntax varchar(MAX) NULL,
subject_concept_id integer NOT NULL,
cohort_initiation_date date NULL )
DISTSTYLE ALL;