-
Notifications
You must be signed in to change notification settings - Fork 7
Enable to use a SQL DB as a storage backend #11
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
Conversation
2c69170
to
ff7570a
Compare
ff7570a
to
ab93c02
Compare
2d756f7
to
d7417da
Compare
I have merged the PR for github-actions - Could you rebase this PR based on that ?
|
|
||
def __init__(self): | ||
super().__init__() | ||
db_url = os.environ.get("CHP_DATABASE_URL", self.default_db_url) |
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.
Instead of using environment variables ? Can we get the configs for this from the jupyter config file ?
For example how the other jupyterhub proxy configs have it: https://jupyterhub-traefik-proxy.readthedocs.io/en/latest/toml.html#example-setup
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.
I have merged the PR for github-actions - Could you rebase this PR based on that ? Also, could you help me understand why do you use
dataset
and notsqlalchemy
directly here ?
dataset
seems to need a bunch of other dependencies which we could avoid - https://github.com/pudo/dataset/blob/master/setup.py#L32
The rationale for using dataset
is that it reduces the effort to implement this feature by about 90%. dataset's core benefit is that it abstracts-away all the sqlalchemy nuts & bolts, in particular we can use Python-dicts as input/output of the DB. Doing the same using sqlalchemy directly would add quite a bit of code for db handling, which dataset allows us to avoid.
Apart from sqlalchemy, dataset adds two dependencies, alembic and banal. To make this feature operationally useful, it needs to support db upgrades (migrations), so alembic
is required anyway. The additional dependency on banal
seems a very small price to pay for that.
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.
Can we get the configs for this from the jupyter config file ?
IMHO jupyter config files should be a concern of Jupyter, not of chp (if chp depends on jupyter configs there will be a dependency chp => jupyter, which would not be useful in my mind).
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.
On the jupyter configs - makes sense
I guess I was more thinking of adding CLI arguments instead of env variables to be consistent with the other configs we use in configurable-http-proxy
configurable_http_proxy/dbstore.py
Outdated
|
||
|
||
class TableTrie: | ||
# A databased URLTrie-alike |
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 add a docstring here explaining how the trie structure is being saved in the DB with an example ?
I was trying to go through the code but reallized I was unable to figure out the table structure we are using (probably due to my lack of knowledge on dataset
).
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 add a docstring here explaining how the trie structure is being saved in the DB with an example ?
Done. On a side note, it might be useful to add a docstring to the trie.URLtrie class because it isn't obvious either ;-)
@@ -27,6 +27,7 @@ The following items are supported: | |||
- Customizable storage backends | |||
- PID file writing | |||
- Logging | |||
- Configurable storage backend |
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.
I think this is an awesome feature and really useful.
We should highlight it by making 3 sections here:
- Features supported (and compatible) with nodejs configurable-http-proxy
- Additional features not available in nodejs configurable-http-proxy
- Features from nodejs configurable-http-proxy not supported (yet)
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.
Updated the README accordingly
bc5f0e6
to
7dc0ace
Compare
🆗 Done |
7dc0ace
to
dd6e633
Compare
bb12fd7
to
343acac
Compare
- add sqlastore.DatabaseStore and unittests - update API unittests for use in database tests - update README
343acac
to
9a06c81
Compare
@miraculixx I use rebase merges to maintain a linear commit history instead of merge commits I made some very small modifications in class names in tests (I avoid using Got the tests to pass and I am good to merge it |
Thanks a lot for the contribution - this is super helpful @miraculixx ! |
Hi @miraculixx @AbdealiLoKo any alternatives that can be used? |
Hi @SMHari The I.e. you need to run Ref: Example 4 in https://pip.pypa.io/en/stable/reference/requirement-specifiers/?highlight=security#examples
|
Hi @AbdealiLoKo But I'm getting the below warning while trying to do the same
But I still tried starting the CHP with the storage-backend argument, it is failing because of the same
Am I missing anything? |
Hm, looks like we haven't released this to pypi yet. |
We just released it @SMHari
NOTE that I have changed it from |
Cool But I'm using this py CHP with my jupyterhub as an alternative to nodejs CHP
|
Hi @SMHari moving this to an issue so we can track it |
Sure @AbdealiLoKo Whether this will be actively addressed or might take some time ? |
closes #9