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

Clean Datastore Tables Job #196

Merged

Conversation

JVickery-TBS
Copy link
Contributor

feat(jobs): added job to delete datastore tables;

  • Added config option clean_datastore_tables.
  • Added job to delete datastore tables from unsupported formats.

This adds the possible feature (controlled by config option) to delete datastore tables for unsupported formats. This is useful in the case that a user updates a Resource to no longer be a datastore resource, but the tables remain. So this helps keep the size of the datastore database down a bit

- Added config option `clean_datastore_tables`.
- Added job to delete datastore tables from unsupported formats.
ckanext/xloader/plugin.py Outdated Show resolved Hide resolved
ckanext/xloader/plugin.py Outdated Show resolved Hide resolved
ckanext/xloader/plugin.py Outdated Show resolved Hide resolved
- Used `get_action` from toolkit instead of ckanapi dependency.
- Reworked some code to make it more gooder.
- Removed `url_changed` check.
ckanext/xloader/plugin.py Outdated Show resolved Hide resolved
ckanext/xloader/plugin.py Outdated Show resolved Hide resolved
- Better logging.
- Added `asbool` for `datastore_active` checks.
- Added falsy check for `url_type`.
ckanext/xloader/plugin.py Outdated Show resolved Hide resolved
- Removed `lower` call in logging.
- Fixed falsy check on `url_type`.
@JVickery-TBS
Copy link
Contributor Author

@ThrawnCA res['id'] changed to resource_id as well, and the .lower() removed from the debug logging on the format.

@ThrawnCA
Copy link
Collaborator

@JVickery-TBS Conflicts need to be resolved after merging #198

@JVickery-TBS
Copy link
Contributor Author

@ThrawnCA conflicts resolved here

ckanext/xloader/plugin.py Outdated Show resolved Hide resolved
- Fixed syntax from flake8.
@JVickery-TBS
Copy link
Contributor Author

@ThrawnCA flake8 should be good now!

qld-gov-au#67 (review) <- am I just going to try and get these automated tests written today. And will shove them in this PR as well

- Added new test for should remove unsupported resources from datastore.
- Fixed mock module path.
- Fixed fixture's `SubRequest` attribute.
- Finalized parameters and fixtures for new test method.
@JVickery-TBS
Copy link
Contributor Author

@ThrawnCA new tests are now passing as expected

- Brought in Thrawn's code to make test method and fixture way less complicated.
# Conflicts:
#	ckanext/xloader/plugin.py
### RESOLVED.
@JVickery-TBS
Copy link
Contributor Author

@ThrawnCA brought in ur test changes, thanks that looks a lot better and makes way way more sense haha.

Also merged master into this one to resolve conflicts

@duttonw duttonw merged commit 67fabfc into ckan:master Feb 3, 2024
3 checks passed
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.

3 participants