-
Notifications
You must be signed in to change notification settings - Fork 206
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
feat(connector):from_key parameter validation #407
Conversation
acad41a
to
4cbf59b
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.
Is it possible for us to write our own request function in a separate utils file and make the interface similar to the original request function, instead of substituting the code in all the places? @pallavibharadwaj
Is this for the requests library substitution? Yes, sure. I'll work on that. |
4cbf59b
to
01a149c
Compare
@pallavibharadwaj would you fix the check failures? |
@peiwangdb The check has failed for code formatting with |
255786f
to
bd63dc5
Compare
@pallavibharadwaj thanks for the information. I am not sure why this formatting issue emerged. Do you have an idea who made the changes? If it is not a hard fix, could you open a new PR to solve the issue and then do a rebase? I can quickly approve of it. |
What would be the alternative to this? |
ceee2c1
to
8850fd8
Compare
|
I've noticed the cutoff for other large Python libraries is 3.6 so may be fine. There's also this paragraph from an article that came out Feb 6, 2019 so the numbers may be more lopsided now: "Regarding Python 2 vs. Python 3 adoption, the survey shows 84 percent using Python 3 and 16 percent still using Python 2. Among the Python 3 users, 54 percent are using Python 3.6 and 30 percent Python 3.7, with the rest split among other versions." On the other hand there may be a substitute for HTTPSConnection but I'm not too sure. @peiwangdb what do you think? |
9bc6572
to
2c2c03e
Compare
Codecov Report
@@ Coverage Diff @@
## develop #407 +/- ##
===========================================
- Coverage 81.17% 80.90% -0.27%
===========================================
Files 73 74 +1
Lines 5535 5625 +90
===========================================
+ Hits 4493 4551 +58
- Misses 1042 1074 +32
Continue to review full report at Codecov.
|
@peiwangdb @dovahcrow I have resolved the issues with the PR. Like I said before, there is still a security warning with HTTPSConnection on older versions of Python (prior to 2.7.9 and 3.4.3), which we discussed can be ignored. |
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.
Very well done!
feat(connector):from_key parameter validation
The PR is addressing two issues:
1. Parameter validation for template params:
Parameter checking happens in dataprep
connector.py
where we check for keys inallowed_params
. This check had to include thefrom_key
to accommodate for the template params.Also Fixed: Finnhub config files had the template keys mentioned differently (the
fromKey
was being passed as part of the query). This has been fixed now on the DataConnector repo along with the corresponding changes in the DBLP config files. [Needs merge of the corresponding PR in the Data Connector repo.]Testing:
fromKey
tested in both DBLP and Finnhub.The following was throwing an error because
first_name
andlast_name
are not directly specified as params in the config file.df = await dc.query("publication", first_name="Jian", last_name="Pei")
Consequence:
In the config files, the
fromKey
in the template paramFieldDef
is now to be specified as aList
instead ofstring
containing all the params the template needs.Ex:
"fromKey": ["first_name", "last_name"]
Note: Single parameter for template should have the key specified an array of one element.
2. Reducing Dependency on Requests Library [#396]:
Replacing the python requests library with our own implementation serving as a wrapper around the standard
http.client
libraryChecklist: