Open arunqa opened 1 year ago
@shah : In the current structure of SQLaide data vaults, we are following the below format:
const syntheticHub1 = dvg.hubTable("synthethic1", {
hub_synthethic1_id: primaryKey(),
h1_bkey_int: integer(),
h1_bkey_text: text(),
h1_bkey_date: date(),
h1_bkey_int_nullable: integerNullable(),
h1_bkey_text_nullable: textNullable(),
...dvg.housekeeping.columns,
});
Here we are using the table_name_id as primary key and other required columns with the housekeeping as well. As per the reference given above, we need to create hub table with a different type of primary key with a different name (email_hash BYTEA PRIMARY KEY). Can you confirm?
Now, we need to do the following:
Setting up the Data Vault tables:
-- Index for the hub
-- Indexes for the satellite
Create as many views as we need for accessing the emails in properly structured format. Talk with Raphael and team for how they do FHIR mapping for complex JSON from unstructured text.
Example for how to insert data – this should be a stored procedure
Assuming we have variables:
-- First, compute the email_hash