-
Notifications
You must be signed in to change notification settings - Fork 0
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
HRQB 12 - Setup QB API and Load tasks #8
Conversation
Why these changes are being introduced: One of the primary functions of this app is to load data into Quickbase via its API. The API has some awkward edges, like the need to upsert data with Field IDs vs Field names, or the need to use Table IDs instead of names. Therefore to upsert data, you might need 2-3 API calls in advance just to map the Table and Field IDs to names. How this addresses that need: * Creates new QBClient class * QBClient has method for making API calls with authorization * QBClient caches API calls when the call signature is identical * QBClient has convenience methods for common API calls like getting Table or Field information * QBClient has some methods to map data * QBClient will be the workhorse of most Load Tasks that get built Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/HRQB-12
Why these changes are being introduced: Load tasks will upsert data into Quickbase. Before any actual Load Tasks exist in this project, we have enough of a framework to create some tests that simulate what Load Tasks will look like and test them a bit. How this addresses that need: * Creates tests in tests/test_load.py that sketch Load Tasks behavior Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/HRQB-12
@ehanson8 , @jonavellecuerdo - it just occurred to me, if you're digging into the
The answer is: the |
@jonavellecuerdo - you had asked in the last PR where and when While only used for |
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.
@ghukill The QBClient
module thus far is understandable and well-written! I just have a couple of clarification questions for you, but it's looking s'wonderful.
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.
@ghukill Looks good to me! Just added one more comment re: including additional info in docstring.
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.
Looks good, one suggestion for breaking up a large method
Purpose and background context
This PR adds a
QBClient
class (commit) that is designed to interact with the Quickbase (QB) API.This client handles logistical things like API credentials, making requests, etc., but also includes some helper methods to query and upsert data to QB.
Example: when upserting data into QB, you must provide a QB Field ID instead of the Field name. These Field IDs are not obvious, and would be cumbersome to code against in the ETL work. This client allows for upserting data via the method
upsert_records()
that accepts a{Field name:value}
structure, where it retrieves information about the table and converts the upload payload to{Field id:value}
structure on-the-fly.Currently there are a couple of additional methods to get information about the QB app, and otherwise describing QB Tables and Fields. It is anticipated as this
hrqb-client
develops, additional convenience methods will be added (e.g. querying records or displaying statistics) that may be directly accessble via CLI commands.In summary, this
QBClient
will be the primary tool used by Load Tasks to upsert data into Quickbase.These changes also introduce two new important env vars:
QUICKBASE_API_TOKEN
: API token used by this app to connect to QBQUICKBASE_APP_ID
: identifier of the QB appHow can a reviewer manually see the effects of these changes?
Without any CLI commands yet, the best way to get a quick understanding of this client is an ipython shell.
Set env vars:
Start shell:
Explore the client a bit:
Includes new or updated dependencies?
YES
Changes expectations for external applications?
NO
What are the relevant tickets?
Developer
Code Reviewer(s)