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 TableView class so things like datasette-graphql can reuse the logic #915

Closed
simonw opened this issue Aug 3, 2020 · 3 comments
Closed

Comments

@simonw
Copy link
Owner

simonw commented Aug 3, 2020

Originally posted by @simonw in simonw/datasette-graphql#2 (comment)

@simonw
Copy link
Owner Author

simonw commented Aug 9, 2020

datasette-graphql uses the logic from TableView right now. It wasn't too unpleasant, but I do worry about the two of them being coupled together in this way.

https://github.com/simonw/datasette-graphql/blob/cc65ec294b0bf8e26213fc68bb5487066de9caab/datasette_graphql/utils.py#L412-L417

        request = Request.fake(path_with_query_string)

        view = TableView(DatasetteSpecialConfig(datasette))
        data, _, _ = await view.data(
            request, database=database_name, hash=None, table=table_name, _next=after
        )

@simonw
Copy link
Owner Author

simonw commented Aug 18, 2020

I'm actually pretty happy with how datasette-graphql works now - maybe the trick here is to redesign the JSON format in #782 such that it can be used as a documented interface by things like datasette-graphql and then ensure Datasette has a documented mechanism for dispatching internal requests.

I just did a horrible hack here that simulates an internal request, so supporting them as a feature would definitely make sense: natbat/rockybeaches@ec102c6

@simonw
Copy link
Owner Author

simonw commented Aug 18, 2020

I'm closing this in favour of an internal requests mechanism in #943.

@simonw simonw closed this as completed Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant