This repository was archived by the owner on Jul 14, 2025. It is now read-only.
FEATURE: Allows CSV file result to be attached in automated PMs#318
Merged
FEATURE: Allows CSV file result to be attached in automated PMs#318
Conversation
This commit adds an optional setting that allows to attach query results in CSV format as a file to PMs sent by Data Explorer's automation scripts. meta topic: https://meta.discourse.org/t/turn-data-explorer-query-results-into-csv-to-attach-to-discourse-automated-emails/267529
Drenmi
approved these changes
Aug 27, 2024
Contributor
Drenmi
left a comment
There was a problem hiding this comment.
LGTM! 🚀
A few opportunities for improving the existing data model, but only suggestions, nothing that blocks this PR. 👍
| params = params_to_hash(query_params) | ||
|
|
||
| result = DataExplorer.run_query(query, params)[:pg_result] | ||
| result = DataExplorer.run_query(query, params) |
Contributor
There was a problem hiding this comment.
I'm thinking if we can promote the return value from a hash to a class or struct instead. Then we could implement for example result.empty? and use that on L:15. It could also implement result.convert which could be delegated to the new converter class. WDYT?
Contributor
Author
There was a problem hiding this comment.
Maybe? But I'm not sure. This result structure should be used in many places. Changing it will affect many files.
|
|
||
| it "works with attached csv file" do | ||
| SiteSetting.personal_message_enabled_groups = group.id | ||
| DiscourseDataExplorer::ResultToMarkdown.expects(:convert).returns("le table") |
d37dddf to
73467e5
Compare
73467e5 to
e998739
Compare
Contributor
Author
|
Thank you for your review! 🚀 |
KrisKotlarek
added a commit
that referenced
this pull request
Apr 23, 2025
Bug introduced during refactoring in this PR: #318 Explain parameter must be passed to `ResultFormatConverter`.
KrisKotlarek
added a commit
that referenced
this pull request
Apr 23, 2025
Bug introduced during refactoring in this PR: #318 Explain parameter must be passed to `ResultFormatConverter`.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 commit adds an optional setting that allows to attach query results in CSV format as a file to PMs sent by Data Explorer's automation scripts.
meta topic: https://meta.discourse.org/t/turn-data-explorer-query-results-into-csv-to-attach-to-discourse-automated-emails/267529
Screenshots