Skip to content

Commit

Permalink
[SNOW-85] Document RAW tables (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymedina authored Dec 19, 2024
1 parent ecebd94 commit ba28178
Show file tree
Hide file tree
Showing 15 changed files with 290 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE aclsnapshots IS 'This table contain snapshots of access-control-list. Snapshots are taken when an acl is created, updated or deleted. Note: Snapshots are also taken periodically and independently of the changes. The snapshot_timestamp records when the snapshot was taken.';

-- Add column comments
COMMENT ON COLUMN aclsnapshots.change_timestamp IS 'The time when the change (created/updated/deleted) on an acl is pushed to the queue for snapshotting.';
COMMENT ON COLUMN aclsnapshots.change_type IS 'The type of change that occurred on the acl, e.g., CREATE, UPDATE, DELETE.';
COMMENT ON COLUMN aclsnapshots.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN aclsnapshots.owner_id IS 'The unique identifier of the Synapse object to which the acl is applied.';
COMMENT ON COLUMN aclsnapshots.owner_type IS 'The type of the Synapse object that the acl is affecting, .e.g., ENTITY, FILE, SUBMISSION, MESSAGE, TEAM.';
COMMENT ON COLUMN aclsnapshots.created_on IS 'The creation time of the acl.';
COMMENT ON COLUMN aclsnapshots.resource_access IS 'The list of principals (users or teams) along with the permissions the principal is granted on the object to which the acl is applied.';
COMMENT ON COLUMN aclsnapshots.snapshot_date IS 'The data is partitioned for fast and cost effective queries. The snapshot_timestamp field is converted into a date and stored in the snapshot_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE teammembersnapshots IS 'This table contain snapshots of team-members. Snapshots are captured when a team and/or its members are modified. Note: Snapshots are also taken periodically and independently of the changes. The snapshot_timestamp records when the snapshot was taken.';

-- Add column comments
COMMENT ON COLUMN teammembersnapshots.change_type IS 'The type of change that occurred to the member of team, e.g., CREATE, UPDATE (Snapshotting does not capture DELETE change).';
COMMENT ON COLUMN teammembersnapshots.change_timestamp IS 'The time when any change to the team was made (e.g. update of the team or a change to its members).';
COMMENT ON COLUMN teammembersnapshots.change_user_id IS 'The unique identifier of the user who made the change to the team member.';
COMMENT ON COLUMN teammembersnapshots.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN teammembersnapshots.team_id IS 'The unique identifier of the team.';
COMMENT ON COLUMN teammembersnapshots.member_id IS 'The unique identifier of the member of the team. The member is a Synapse user.';
COMMENT ON COLUMN teammembersnapshots.is_admin IS 'If true, then the member is manager of the team.';
COMMENT ON COLUMN teammembersnapshots.snapshot_date IS 'The data is partitioned for fast and cost effective queries. The snapshot_timestamp field is converted into a date and stored in the snapshot_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE teamsnapshots IS 'This table contain snapshots of teams. Snapshots are taken when teams or its members are created or updated. Note: Snapshots are also taken periodically and independently of the changes. The snapshot_timestamp records when the snapshot was taken.';

-- Add column comments
COMMENT ON COLUMN teamsnapshots.change_type IS 'The type of change that occurred to the team, e.g., CREATE, UPDATE (Snapshotting does not capture DELETE change).';
COMMENT ON COLUMN teamsnapshots.change_timestamp IS 'The time when any change to the team was made (e.g. create, update or a change to its members).';
COMMENT ON COLUMN teamsnapshots.change_user_id IS 'The unique identifier of the user who made the change to the team.';
COMMENT ON COLUMN teamsnapshots.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN teamsnapshots.id IS 'The unique identifier of the team.';
COMMENT ON COLUMN teamsnapshots.name IS 'The name of the team.';
COMMENT ON COLUMN teamsnapshots.can_public_join IS 'If true, a user can join the team without approval of a team manager.';
COMMENT ON COLUMN teamsnapshots.created_by IS 'The unique identifier of the user who created the team.';
COMMENT ON COLUMN teamsnapshots.created_on IS 'The creation time of the team.';
COMMENT ON COLUMN teamsnapshots.modified_by IS 'The unique identifier of the user who last modified the team.';
COMMENT ON COLUMN teamsnapshots.modified_on IS 'The time when the team was last modified.';
COMMENT ON COLUMN teamsnapshots.snapshot_date IS 'The data is partitioned for fast and cost effective queries. The snapshot_timestamp field is converted into a date and stored in the snapshot_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE usergroupsnapshots IS 'This table lists all principals (individual users and groups of users). (A group is the low-level object of a underlying team, much like a file handle is the low-level object of an underlying file entity.) In addition to explicit users and teams, principals in Synapse include the anonymous user, the implicit group of all authenticated users, and the implicit public group which includes all users, authenticated or not. Note: Snapshots are also taken periodically and independently of the changes. The snapshot_timestamp records when the snapshot was taken.';

-- Add column comments
COMMENT ON COLUMN usergroupsnapshots.change_type IS 'The type of change that occurred to the user-group, e.g., CREATE, UPDATE (Snapshotting does not capture DELETE change).';
COMMENT ON COLUMN usergroupsnapshots.change_timestamp IS 'The time when the change (creation/update) to the user-group is pushed to the queue for snapshotting.';
COMMENT ON COLUMN usergroupsnapshots.change_user_id IS 'The unique identifier of the user who made the change to the user-group.';
COMMENT ON COLUMN usergroupsnapshots.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN usergroupsnapshots.id IS 'The unique identifier of user or group.';
COMMENT ON COLUMN usergroupsnapshots.is_individual IS 'If true, then this user group is an individual user not a team.';
COMMENT ON COLUMN usergroupsnapshots.created_on IS 'The creation time of the user or group.';
COMMENT ON COLUMN usergroupsnapshots.snapshot_date IS 'The data is partitioned for fast and cost effective queries. The snapshot_timestamp field is converted into a date and stored in the snapshot_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE userprofilesnapshot IS 'This table contain snapshots of user-profiles. Snapshots are taken when user profiles are created or modified. Note: Snapshots are also taken periodically and independently of the changes. The snapshot_timestamp records when the snapshot was taken.';

-- Add column comments
COMMENT ON COLUMN userprofilesnapshot.change_type IS 'The type of change that occurred to the user profile, e.g., CREATE, UPDATE (Snapshotting does not capture DELETE change).';
COMMENT ON COLUMN userprofilesnapshot.change_timestamp IS 'The time when any change to the user profile was made (e.g. create or update).';
COMMENT ON COLUMN userprofilesnapshot.change_user_id IS 'The unique identifier of the user who made the change to the user profile.';
COMMENT ON COLUMN userprofilesnapshot.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN userprofilesnapshot.id IS 'The unique identifier of the user.';
COMMENT ON COLUMN userprofilesnapshot.user_name IS 'The Synapse username.';
COMMENT ON COLUMN userprofilesnapshot.first_name IS 'The first name of the user.';
COMMENT ON COLUMN userprofilesnapshot.last_name IS 'The last name of the user.';
COMMENT ON COLUMN userprofilesnapshot.email IS 'The primary email of the user.';
COMMENT ON COLUMN userprofilesnapshot.location IS 'The location of the user.';
COMMENT ON COLUMN userprofilesnapshot.company IS 'The company where the user works.';
COMMENT ON COLUMN userprofilesnapshot.position IS 'The position of the user in the company.';
COMMENT ON COLUMN userprofilesnapshot.created_on IS 'The creation time of the user profile.';
COMMENT ON COLUMN userprofilesnapshot.snapshot_date IS 'The data is partitioned for fast and cost effective queries. The snapshot_timestamp field is converted into a date and stored in the snapshot_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE verificationsubmissionsnapshots IS 'This table contain snapshots of submissions of user verification data by ACT. Snapshots are taken when a submission is created or updated. Note: Snapshots are also taken periodically and independently of the changes. The snapshot_timestamp records when the snapshot was taken.';

-- Add column comments
COMMENT ON COLUMN verificationsubmissionsnapshots.change_timestamp IS 'The time when the change (created/updated) on a submission is pushed to the queue for snapshotting.';
COMMENT ON COLUMN verificationsubmissionsnapshots.change_type IS 'The type of change that occurred on the submission, e.g., CREATE, UPDATE.';
COMMENT ON COLUMN verificationsubmissionsnapshots.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN verificationsubmissionsnapshots.id IS 'The unique identifier of the submission.';
COMMENT ON COLUMN verificationsubmissionsnapshots.created_on IS 'The creation time of the submission.';
COMMENT ON COLUMN verificationsubmissionsnapshots.created_by IS 'The unique identifier of the user who, created the submission';
COMMENT ON COLUMN verificationsubmissionsnapshots.state_history IS 'The sequence of submission states (SUBMITTED, REJECTED, APPROVED) for the submission.';
COMMENT ON COLUMN verificationsubmissionsnapshots.snapshot_date IS 'The data is partitioned for fast and cost effective queries. The snapshot_timestamp field is converted into a date and stored in the snapshot_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE certifiedquiz IS 'This table contain records of the certification quiz taken by a Synapse user.';

-- Add column comments
COMMENT ON COLUMN certifiedquiz.response_id IS 'The unique identifier of a response wherein a user submitted a set of answers while participating in the quiz.';
COMMENT ON COLUMN certifiedquiz.user_id IS 'The unique identifier of the user who took the quiz.';
COMMENT ON COLUMN certifiedquiz.passed IS 'If true, the user passed the quiz.';
COMMENT ON COLUMN certifiedquiz.passed_on IS 'The date on which the user took the quiz, regardless of whether user passed or failed the test.';
COMMENT ON COLUMN certifiedquiz.stack IS 'The stack (prod, dev) on which the quiz record was processed.';
COMMENT ON COLUMN certifiedquiz.instance IS 'The version of the stack that processed the quiz record.';
COMMENT ON COLUMN certifiedquiz.record_date IS 'The data is partitioned for fast and cost effective queries. The timestamp field is converted into a date and stored in the record_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE certifiedquizquestion IS 'This table contain records of the questions of the certification quiz. Each record in the table is question answered by the user in the quiz.';

-- Add column comments
COMMENT ON COLUMN certifiedquizquestion.response_id IS 'The unique identifier of a response wherein a user submitted a set of answers while participating in the quiz.';
COMMENT ON COLUMN certifiedquizquestion.question_index IS 'The position of the question within the quiz.';
COMMENT ON COLUMN certifiedquizquestion.is_correct IS 'If true, the answer to the question was correct.';
COMMENT ON COLUMN certifiedquizquestion.stack IS 'The stack (prod, dev) on which the quiz question record was processed.';
COMMENT ON COLUMN certifiedquizquestion.instance IS 'The version of the stack that processed the quiz question record.';
COMMENT ON COLUMN certifiedquizquestion.record_date IS 'The data is partitioned for fast and cost effective queries. The timestamp field is converted into a date and stored in the record_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE certifiedquizquestionsnapshots IS 'This table contain snapshots of the questions of the certification quiz. With each entry representing a question answered by the user during the quiz.';

-- Add column comments
COMMENT ON COLUMN certifiedquizquestionsnapshots.change_type IS 'The change type is always as CREATE since each instance of a user submitting a quiz results in a new submission of the quiz.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.change_timestamp IS 'The time when the user submitted the quiz.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.change_user_id IS 'The unique identifier of the user that submitted the quiz.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN certifiedquizquestionsnapshots.response_id IS 'The unique identifier of a response wherein a user submitted a set of answers while participating in the quiz.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.question_index IS 'The position of the question within the quiz.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.is_correct IS 'If true, the answer to the question was correct.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.stack IS 'The stack (prod, dev) on which the quiz question record was processed.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.instance IS 'The version of the stack that processed the quiz question record.';
COMMENT ON COLUMN certifiedquizquestionsnapshots.snapshot_date IS 'The data is partitioned for fast and cost effective queries. The snapshot_timestamp field is converted into a date and stored in the snapshot_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE certifiedquizsnapshots IS 'This table contain snapshots of the certification quiz submitted by a Synapse user. Snapshots are taken when a user submit the quiz. Note: Snapshots are also taken periodically and independently of the changes. The snapshot_timestamp records when the snapshot was taken.';

-- Add column comments
COMMENT ON COLUMN certifiedquizsnapshots.change_type IS 'The change type is always as CREATE since each instance of a user submitting a quiz results in a new submission of the quiz.';
COMMENT ON COLUMN certifiedquizsnapshots.change_timestamp IS 'The latest time when the change message was sent to the queue for snapshotting.';
COMMENT ON COLUMN certifiedquizsnapshots.snapshot_timestamp IS 'The time when the snapshot was taken (It is usually after the change happened).';
COMMENT ON COLUMN certifiedquizsnapshots.response_id IS 'The unique identifier of a response wherein a user submitted a set of answers while participating in the quiz.';
COMMENT ON COLUMN certifiedquizsnapshots.user_id IS 'The unique identifier of the user who submitted the quiz.';
COMMENT ON COLUMN certifiedquizsnapshots.passed IS 'If true, the user passed the quiz.';
COMMENT ON COLUMN certifiedquizsnapshots.passed_on IS 'The date on which the user submit the quiz, regardless of whether user passed or failed the test.';
COMMENT ON COLUMN certifiedquizsnapshots.stack IS 'The stack (prod, dev) on which the quiz record was processed.';
COMMENT ON COLUMN certifiedquizsnapshots.instance IS 'The version of the stack that processed the quiz record.';
COMMENT ON COLUMN certifiedquizsnapshots.revoked IS 'If true, the record was revoked by an ACT member.';
COMMENT ON COLUMN certifiedquizsnapshots.revoked_on IS 'The date/time when the record was revoked, can be null if the record was never revoked.';
COMMENT ON COLUMN certifiedquizsnapshots.certified IS 'If true the user is certified through this record, can be true iif passed is true and revoked is false.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP

-- Add table comment
COMMENT ON TABLE filedownload IS 'The table contain records of all the downloads of the Synapse, e.g., file, zip/package, attachments. The events are recorded only after the pre-signed url for requested download entity is generated.';

-- Add column comments
COMMENT ON COLUMN filedownload.timestamp IS 'The time when the file download event is pushed to the queue for recording, after generating the pre-signed url.';
COMMENT ON COLUMN filedownload.user_id IS 'The id of the user who downloaded the file.';
COMMENT ON COLUMN filedownload.project_id IS 'The unique identifier of the project where the downloaded entity resides. Applicable only for FileEntity and TableEntity.';
COMMENT ON COLUMN filedownload.file_handle_id IS 'The unique identifier of the file handle.';
COMMENT ON COLUMN filedownload.downloaded_file_handle_id IS 'The unique identifier of the zip file handle containing the downloaded file when the download is requested as zip/package, otherwise the id of the file handle itself.';
COMMENT ON COLUMN filedownload.association_object_id IS 'The unique identifier of the Synapse object (without ''syn'' prefix) that wraps the file.';
COMMENT ON COLUMN filedownload.association_object_type IS 'The type of the Synapse object that wraps the file, e.g., FileEntity, TableEntity, WikiAttachment, WikiMarkdown, UserProfileAttachment, MessageAttachment, TeamAttachment.';
COMMENT ON COLUMN filedownload.stack IS 'The stack (prod, dev) on which the download request was processed.';
COMMENT ON COLUMN filedownload.instance IS 'The version of the stack that processed the download request.';
COMMENT ON COLUMN filedownload.session_id IS 'The UUID assigned to the API request that triggered this download. By joining this table with the processedaccessrecord on session_id, more information about the call that triggered this download can be found.';
COMMENT ON COLUMN filedownload.record_date IS 'The data is partitioned for fast and cost effective queries. The timestamp field is converted into a date and stored in the record_date field for partitioning. The date should be used as a condition (WHERE CLAUSE) in the queries.';
Loading

0 comments on commit ba28178

Please sign in to comment.