VOOZH about

URL: https://thenewstack.io/work-with-sql-via-plug-ins-an-introduction-to-using-steampipe/

⇱ Work With SQL via Plug-Ins: An Introduction To Using Steampipe - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2024-06-19 08:00:52
Work With SQL via Plug-Ins: An Introduction To Using Steampipe
tutorial,
Data / Programming Languages

Work With SQL via Plug-Ins: An Introduction To Using Steampipe

Steampipe has many plug-ins to convert internal app data to nice SQL tables. In this post, we look at how the Slack plug-in works.
Jun 19th, 2024 8:00am by David Eastman
👁 Featued image for: Work With SQL via Plug-Ins: An Introduction To Using Steampipe
Image via Unsplash+.
SQL has always been a data lingua franca, allowing hard data to be extracted from different domains. This is why I was specifically intrigued by the way Steampipe can read app data through SQL. It has many plug-ins to convert internal app data to nice SQL tables. In this post, I’ll look at the Slack plug-in, which I’ll connect and then use on a live workspace. However, we know before we start that there will be quite a bit of effort to prepare the access to what is a third-party app from Slack’s viewpoint. This is the downside of attempting to open up an application’s data. What I like about Steampipe is that you can prepare a sensible query before you attach it to a system. This is useful for consultants who may have limited access to systems, so they need to bring a reasonably wide set of tools around with them. There is a CLI available for my version of macOS, and I’m quite happy to use its interface. As usual, I use Warp for my shell, though Steampipe has its own CLI that will take precedence later on. After three minutes of updating Homebrew, I installed Steampipe directly: 👁 Image
Then, a quick version check to make sure the installation worked: 👁 Image
Then, I installed the Slack plug-in: 👁 Image

Preparing To Interrogate Slack

There are several reasons why you might want to quiz an organization’s Slack, especially if you are dropping in on a team and need to establish a community of practice (CoP), or simply want to get a feel for which users are most active, or whether certain issues (or ticket numbers) are being discussed. But first of all, how do we connect to it? Fortunately, Slack has a way of granting tokens within scopes for apps to use. I used this method way back when I looked at Dark, the serverless backend tool. It was somewhat tricky then, so I was hoping it had become a little simpler. However, this process was only slightly smoother. I tried to do this using the Mac version of the Slack app, but couldn’t. However, it is a straightforward process from the website. Check in to your target Slack workspace, then go to api.slack.com/apps. From here, we can create a new app, select “from scratch,” and then give it a name. The “app” is what Slack is referring to as the third-party access service from Steampipe: 👁 Image
We can then select permissions and gain our scoped token access. I’m avoiding any admin-related scopes, and making sure to include “team,” “users,” “groups,” etc.: 👁 Image
You can always return to this section, add any missing scopes and reinstall the app. This will allow the app to retrieve basic information from Slack. Finally, we’ll install our new tool and its OAuth tokens to the workspace. Be sure to make a copy of your long User OAuth Token: 👁 Image
As usual, Slack will show you its warning that it is requesting access (or a reason that it cannot). Make sure you see the tick next to “Install your app” on the progress list: 👁 Image
Now go back to your shell and add that token into Steampipe’s Slack configuration file: 👁 Image

Querying the Data

Now we are finally ready to see what we can do in Steampipe itself. Yay! We’ll access the CLI’s query mode, and immediately will want to review the list of available tables (note that autocompletion suggestions are provided): 👁 Image
(Press Ctrl+D on a blank line, or use the .exit command.) Here is the result:
 ==> slack
+---------------------------+---------------------------------------------------------+ 
| table | description | 
+---------------------------+---------------------------------------------------------+ 
| slack_access_log | Logins to Slack, grouped by User, IP and User Agent. | 
| slack_connection | Information about the connection to the Slack workspace.| 
| slack_conversation | Unified interface to all conversation like things.. | 
| slack_conversation_member | Retrieve members of a conversation. | 
| slack_emoji | Slack emoji installed in the workspace. | 
| slack_group | Slack workspace user groups. |
| slack_search | Search slack for anything using a query. |
| slack_user | Slack workspace users. | 
+---------------------------+---------------------------------------------------------+ 

To get information about the columns in a table, run .inspect {connection}.{table}. Before continuing on, try this command to confirm whether you have a connection:
> select * from slack_user;
Make sure you get some useful data back. If not, check that the installation is complete or whether the access tokens are sufficient. Before we query in anger, let’s take a quick look at the slack_user table:
> .inspect slack_user
First, I want to see which users are not bots and are not deleted, as well as who has updated their account to use two-factor authentication: 👁 Image
For some reason, the Slackbot is not a bot! But I can see that two people may need a security reminder, if that was my concern. Now let’s look at slack_search table, which can zoom in more accurately on information: 👁 Image
Note that channel is a JSON type, which at first would seem a bit problematic. However, you can use the ->> operator to extract text. You must specify the query in the where clause to query this table. Here is a quick search for mentions of “ChatGPT” in the workspace’s channels: 👁 Image
But we might want a bit more information on when that was mentioned: 👁 Image
Using the slack_conversation table, we can find out about popular channels by counting the members:
select name,num_members from slack_conversation where
num_members is not null
order by num_members desc
limit 5;
Because we are using SQL, we can of course get much more focused queries between tables, depending on what you need to find out. Hopefully, you can see that Steampipe is a useful tool for retrieving valuable data, and that this Slack plug-in provides a good example of what we can get out. Having a prepared list of useful SQL queries can save you time if you only have limited access to a system — a good way to get the data you need in a flexible format of your choice.
TRENDING STORIES
David has been a London-based professional software developer with Oracle Corp. and British Telecom, and a consultant helping teams work in a more agile fashion. He wrote a book on UI design and has been writing technical articles ever since....
Read more from David Eastman
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.