Add new CLI command: ckan shell#6919
Merged
Merged
Conversation
Member
|
Yes!! Pylons used to have this and it was super useful |
amercader
reviewed
Jun 21, 2022
Member
Author
|
I've implemented the feedback @Zharktas ! Let me know if anything else is needed :) |
Member
|
@pdelboca want to add changelog entry for this, I think otherwise this is good to go. |
Zharktas
approved these changes
Aug 9, 2022
Member
|
Failing lint and tests are in master, i'll merge this once everything else is green :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This new command is inspired by Flask's
flask shelland Django'smanage.py shellcommands. The main goal is to execute a IPython session with the application loaded for easy debugging and dynamic coding.This provides several advantages like direct access to the model or logic layer to interact directly with all the services configured in our config files.
There are three variables already populated into the namespace of the shell:
appcontaining the Flask applicationconfigcontaining the CKAN config dictrionarymodelmodule to access to the database using SQLAlchemy syntaxExample 1:
Example 2:
I can also do some quick benchmarking of functions to test out new implementations:
I think this command will improve the CKAN development experience.