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

Add sharing feature #410

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Add sharing feature #410

wants to merge 12 commits into from

Conversation

abuisman
Copy link

@abuisman abuisman commented Aug 7, 2022

We are looking at replacing, amongst other things, Heroku dataclips with Blazer. The thing that we use a lot with dataclips is the sharing feature: it allows a developer to write a SQL query, they then share the CSV url with a non-technical person who can then import that into whatever tool that supports CSVs. Every time they re-download the CSV it is up-to-date with the query. When importing into Google sheets it results in an always up-to-date sheet, great all around.

In this PR I have added the feature to Blazer.

image

In building I realised I can still extract it and sort of patch it in, but I'd rather contribute back. I've tried to keep close to the overall design and style.

The only change I needed to make to the QueriesController that might be a good change regardless of this feature is the following:

From:

@statement = Blazer::Statement.new(params[:statement], @data_source)

To:

sql_statement = params[:statement] || @query.statement
@statement = Blazer::Statement.new(sql_statement, @data_source)

app/controllers/blazer/queries_controller.rb Outdated Show resolved Hide resolved
lib/blazer/sharing.rb Outdated Show resolved Hide resolved
@abuisman
Copy link
Author

I've updated the design as suggested by @bdewater. I now generate a token per query which allows for easy per-query revoking of access. Great suggestion.

@abuisman abuisman requested a review from bdewater September 11, 2023 21:13
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