Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new query for edx activity table #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,11 @@ databaseChangeLog:
changes:
- sqlFile:
path: 001-generate_data_for_data_sync_config-005.sql
splitStatements: false
- changeSet:
id: 7
author: liquibase
changes:
- sqlFile:
path: 001-generate_data_for_data_sync_config-006.sql
splitStatements: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
-- Removing obsoleted query
ndduc01 marked this conversation as resolved.
Show resolved Hide resolved
DELETE
FROM [dbo].[data_sync_config]
WHERE table_name = 'EDX_ACTIVITY_LOG';

DELETE
FROM [dbo].[data_sync_config]
WHERE table_name = 'EDX_ACTIVITY_DETAIL_LOG';


INSERT INTO [RDB].[dbo].[data_sync_config]
(table_name, source_db, query, query_with_null_timestamp, query_count, query_with_pagination)
VALUES
('EDX_ACTIVITY_LOG', 'NBS_ODSE', 'SELECT *
FROM EDX_ACTIVITY_LOG
WHERE record_status_time :operator :timestamp;', NULL, 'SELECT COUNT(*)
FROM EDX_ACTIVITY_LOG
WHERE record_status_time :operator :timestamp;', 'WITH PaginatedResults AS (
SELECT *, ROW_NUMBER() OVER (ORDER BY record_status_time ASC) AS RowNum
FROM EDX_ACTIVITY_LOG
WHERE record_status_time :operator :timestamp
)
SELECT * FROM PaginatedResults
WHERE RowNum BETWEEN :startRow AND :endRow;')
;

INSERT INTO [RDB].[dbo].[data_sync_config]
(table_name, source_db, query, query_with_null_timestamp, query_count, query_with_pagination)
VALUES
('EDX_ACTIVITY_DETAIL_LOG', 'NBS_ODSE', 'SELECT logg.record_status_time, detail.*
FROM EDX_ACTIVITY_DETAIL_LOG AS detail
INNER JOIN EDX_ACTIVITY_LOG AS logg
ON detail.edx_activity_log_uid = logg.edx_activity_log_uid
WHERE logg.record_status_time :operator :timestamp;', NULL, 'SELECT COUNT(*)
FROM EDX_ACTIVITY_DETAIL_LOG AS detail
INNER JOIN EDX_ACTIVITY_LOG AS logg
ON detail.edx_activity_log_uid = logg.edx_activity_log_uid
WHERE logg.record_status_time :operator :timestamp;', 'WITH PaginatedResults AS (
SELECT logg.record_status_time, detail.*, ROW_NUMBER() OVER (ORDER BY logg.record_status_time ASC) AS RowNum
FROM EDX_ACTIVITY_DETAIL_LOG AS detail
INNER JOIN EDX_ACTIVITY_LOG AS logg
ON detail.edx_activity_log_uid = logg.edx_activity_log_uid
WHERE logg.record_status_time :operator :timestamp
)
SELECT * FROM PaginatedResults
WHERE RowNum BETWEEN :startRow AND :endRow;')
;