Skip to content
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

Refactor load.py to have an agnostic config #16

Merged
merged 1 commit into from
Jun 12, 2020
Merged

Conversation

hannelita
Copy link
Contributor

Relates to the first task on #10 ; use a continuation on the methods is not ideal yet. We could refactor and create a class wrapping the original library. Can we make it a singleton? In my opinion, it would make sense.

@rufuspollock This refactor suggestion is a matter of cleaning the codebase. Is there time to do so? Work est (to refactor classes and the tests that will break: 2h)

@@ -31,10 +25,10 @@ def load_csv(data_resource, config={}, connection=None):


def delete_datastore_table(data_resource, config={}):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me config is a bad smell - can't we pass arguments explicitly?

@@ -31,10 +25,10 @@ def load_csv(data_resource, config={}, connection=None):


def delete_datastore_table(data_resource, config={}):
header = {'Authorization': Variable.get('CKAN_SYSADMIN_API_KEY')}
header = {'Authorization': config['CKAN_SYSADMIN_API_KEY']}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not pass these arguments explicitly to the function rather than pull from config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean passing several args like load.create_datastore_table(data_resource, Variable.get('CKAN_SYSADMIN_API_KEY'), Variable.get('CKAN_SITE')) ?

@rufuspollock
Copy link
Member

@hannelita i'm happy either way - i'm not totally clear if we want to go class way vs just have arguments to library functions ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants