Collaborate on your SQL queries and results directly within Slack!

Published on 09 April 2021 in Version 4.10 - 3 minutes read - Last modified on 27 May 2021 - Read in jp

Introducing the Slack integration for Hue SQL Editor

The Hue project which is celebrating its 11th anniversary this year is based on these three principles:

Query. Explore. Share.

The ‘Share’ principle got its last improvement with the introduction of Public Links and Gist Sharing for better collaboration. Following that path, it is time for the next improvement ;)

What could be better than improving the collaboration by using one of the best communication platforms present - Slack!

And when there is Slack, there are Slack Apps! And our beloved Hue is getting one!

Although currently in beta, this app integration expands the ability to share query links or gists to the desired Slack channels which then unfurls in a rich preview for other users. It even gives you the result file if the result has not expired.

Share to Slack Architecture

The main bot logic lies on top of the Hue server listening to the events posted by the Hue App from Slack to an endpoint, processing the data accordingly and using Slack API methods for sending the desired response.

To set-up the SQL Assistant App, follow these steps mentioned in the Hue docs

Now, open Editor, run some query and copy its link:

Run Query in Editor

Paste it in the Slack channel and see the unfurling magic!

Query Link Preview

Wonder why result is shown like this?

Slack currently does not support markdown tables and potential improvements with inline preview will come when Hue supports result caching via query tasks.

After evaluating a lot of possible fixes (like uploading result image, truncating columns which doesn't look good, pivoting table, uploading result file etc.) and seeing their tradeoffs, we chose to have few sample rows but keep all columns by pivoting the result table and to compensate for the loss of rows, Hue app gives the result file in the message thread.

Message Thread with Result File

Users can share the SQL gists too!

Gist Link

Gist Link Preview

Read access

Keeping in mind the security aspect, those Slack users who are Hue users and have the read permissions to access the query and its result will get this rich preview and result file after sharing the link. This mapping is currently done by checking the email prefix and its host for Hue username.

For example, some person ‘Alice’ having a Hue account with username ‘alice’ can have read access from some Slack account only if it's the same email address from the same domain. i.e. [email protected] slack user can only access Hue user ‘alice’ on hue.gethue.com.

What's coming up next?

In the follow-ups, promoting the Share to Slack from the Hue side where users can select the channel to send the link.

Also stay tuned for more such functionalities such as replying to users asking questions on how to find certain data tables or to query them and also send results for scheduled queries in certain Slack channels!

Try it out!

Log in to the Slack workspace to access the demo SQL Assistant by using the following Slack account credentials:

  email: [email protected]
  password: gethue

Read its user guide and stay tuned for upcoming updates.

Till then, run some queries, copy those links and share ‘em all!



Any feedback or question? Feel free to comment here or on the Forum and quick start SQL querying!

Onwards!

Harsh from the Hue Team


comments powered by Disqus

More recent stories

26 June 2024
Integrating Trino Editor in Hue: Supporting Data Mesh and SQL Federation
Read More
03 May 2023
Discover the power of Apache Ozone using the Hue File Browser
Read More