-
Notifications
You must be signed in to change notification settings - Fork 1
Data Package should contain a publishers.jl file too #269
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
Open
jarofgreen
wants to merge
1
commit into
live
Choose a base branch
from
grantnav-issue-862
base: live
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,20 +87,32 @@ def create_orgs_list(entity_type, output=sys.stdout): | |
entity_type: publisher, recipient, funder | ||
output: io | ||
""" | ||
query = f""" | ||
SELECT DISTINCT | ||
db_{entity_type}.org_id as "id", | ||
db_{entity_type}.non_primary_org_ids as "non_primary_org_ids", | ||
db_{entity_type}.name as name, | ||
db_{entity_type}."aggregate" as "aggregate", | ||
db_{entity_type}.additional_data as "additionalData", | ||
additional_data_orginfocache.data as "ftcData", | ||
db_publisher.name as "publisherName", | ||
db_publisher.prefix as "publisherPrefix" | ||
FROM db_{entity_type} | ||
LEFT OUTER JOIN additional_data_orginfocache on db_{entity_type}.org_id = additional_data_orginfocache.org_id | ||
LEFT OUTER JOIN db_publisher on db_{entity_type}.org_id = db_publisher.org_id OR db_publisher.org_id = ANY(db_{entity_type}.non_primary_org_ids) | ||
""" | ||
if entity_type == "publisher": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did try one query var and several ("" if x else "") in the middle but it seemed like this way was way more readable. |
||
query = f""" | ||
SELECT DISTINCT | ||
db_{entity_type}.org_id as "id", | ||
db_{entity_type}.name as name, | ||
db_{entity_type}."aggregate" as "aggregate", | ||
db_{entity_type}.additional_data as "additionalData", | ||
additional_data_orginfocache.data as "ftcData" | ||
FROM db_{entity_type} | ||
LEFT OUTER JOIN additional_data_orginfocache on db_{entity_type}.org_id = additional_data_orginfocache.org_id | ||
""" | ||
else: | ||
query = f""" | ||
SELECT DISTINCT | ||
db_{entity_type}.org_id as "id", | ||
db_{entity_type}.non_primary_org_ids as "non_primary_org_ids", | ||
db_{entity_type}.name as name, | ||
db_{entity_type}."aggregate" as "aggregate", | ||
db_{entity_type}.additional_data as "additionalData", | ||
additional_data_orginfocache.data as "ftcData", | ||
db_publisher.name as "publisherName", | ||
db_publisher.prefix as "publisherPrefix" | ||
FROM db_{entity_type} | ||
LEFT OUTER JOIN additional_data_orginfocache on db_{entity_type}.org_id = additional_data_orginfocache.org_id | ||
LEFT OUTER JOIN db_publisher on db_{entity_type}.org_id = db_publisher.org_id OR db_publisher.org_id = ANY(db_{entity_type}.non_primary_org_ids) | ||
""" | ||
|
||
def parse_data_in_result(result, col_types): | ||
# work around for https://github.com/ThreeSixtyGiving/datastore/issues/125 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting comment, I wasn't sure if it ever worked in the past or was just planned to work at some point in the future