-
Notifications
You must be signed in to change notification settings - Fork 1
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
Library KPIs: items in the institutional repo #31
Conversation
4d8c5ec
to
9a0f74c
Compare
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.
Thank you, just few comments
|
||
results = join_and_add_year(counts) | ||
|
||
populate_items_in_the_institutional_repository = PostgresOperator( |
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.
I really like the approach of Postgres Operator although I feel reluctant about raw SQL operations. With a quick search I found that it's possible to use SQLAlchemy for this kind of operations https://sorokin.engineer/posts/en/apache_airflow_sqlalchemy_operator.html. Can we give it a try?
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.
@ErnestaP only this is missing to investigate, thank you
dags/migrations/versions/101f23913167_library_kpis_new_items_in_the_.py
Outdated
Show resolved
Hide resolved
a7260ec
to
eaf68ac
Compare
@sqlalchemy_task(conn_id="superset_qa") | ||
def populate_golden_open_access(results, session, **kwargs): | ||
record = ( | ||
session.query(OAGoldenOpenAccess).filter_by(year=results["year"]).first() |
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.
this will fail if there is None, we have to do first_or_none()
) | ||
@sqlalchemy_task(conn_id="superset_qa") | ||
def populate_open_access(results, session, **kwargs): | ||
record = session.query(OAOpenAccess).filter_by(year=results["year"]).first() |
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.
ditto
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.
Great, it looks much cleaner this way! Few minor comments
|
||
|
||
class LibraryNewItemsInTheInstitutionalRepository(Base): | ||
__tablename__ = "items_in_the_institutional_repository" |
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.
__tablename__ = "items_in_the_institutional_repository" | |
__tablename__ = "library_items_in_the_institutional_repository" |
record = ( | ||
session.query(LibraryCernPublicationRecords) | ||
.filter_by(year=results["year"]) | ||
.first() |
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.
ditto
eaf68ac
to
233cc14
Compare
No description provided.