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

IT-3448: procedure to simplify listing file downloaders #27

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

xschildw
Copy link
Contributor

This PR creates a procedure to simplify list who dowloaded files within one or more subtrees.

Example: 'call list_downloaders('2021-01-01', '25982471')

Returns a table:

USER_ID USER_NAME EMAIL SYNAPSE_PROFILE NUM_DOWNLOADS EARLIEST_DOWNLOAD_TIME LATEST_DOWNLOAD_TIME
1223456 myUser [email protected] https://www.synapse.org/#!Profile:123456 10 2023-01-14 12:01:00 2023-02-01 01:00:04

Copy link

sonarcloud bot commented Feb 28, 2024

Quality Gate Passed Quality Gate passed

Issues
6 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@xschildw xschildw requested a review from thomasyu888 February 28, 2024 16:45
@@ -0,0 +1,41 @@
CREATE OR REPLACE PROCEDURE list_downloaders(start_record_date string, entity_list string)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the DATE type here? string is also fine, but you can do something like

record_date > DATE('2024-02-16')

query_str2 varchar default
'download (user_id, timestamp, entity_id) as (
select fd.user_id, fd.timestamp, fd.association_object_id as entity_id
from filedownload fd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to use this function, I assume you have to do:

USE SCHEMA synapse_data_warehouse.synapse # or ...dev.synapse

Is that right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants