-
Notifications
You must be signed in to change notification settings - Fork 43
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
Scalability issues #247
Scalability issues #247
Changes from 3 commits
4c85132
eb82ece
691b044
a0af7ea
e6d58ba
f98bb64
99e0f93
670e94d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from itertools import chain | ||
from datapackage import exceptions | ||
|
||
|
||
# Module API | ||
|
@@ -52,3 +53,24 @@ def read(self, limit=None, **options): | |
if count == limit: | ||
break | ||
return rows | ||
|
||
def check_relations(self): | ||
# this function mimics the resource.check_relations but optimize it for groups | ||
# it's also a prototype to proprose a faster check_relations process for all resources | ||
|
||
# opti relations should ne loaded only once for the group | ||
foreign_keys_values = self.__resources[0].get_foreign_keys_values() | ||
|
||
# alternative to check_relations from tableschema-py | ||
for resource in self.__resources: | ||
try: | ||
resource.check_relations(foreign_keys_values=foreign_keys_values) | ||
except exceptions.DataPackageException as exception: | ||
print('in %s: ' % resource.name) | ||
if exception.multiple: | ||
for error in exception.errors: | ||
print(error) | ||
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. Probably a debug print instead of raise? 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. Indeed, raising looks like the good thing to do. |
||
else: | ||
print(exception) | ||
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. Probably a debug print instead of raise? 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. Indeed, raising looks like the good thing to do |
||
|
||
return True |
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.
Could you please add a test for this method - https://coveralls.io/builds/26209815/source?filename=datapackage%2Fgroup.py#L62?
Our coverage dropped below its validity threshold
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.
Yep almost done.