Git Product home page Git Product logo

turbot / steampipe-plugin-slack Goto Github PK

View Code? Open in Web Editor NEW
14.0 11.0 8.0 455 KB

Use SQL to instantly query users, channels, emoji and more from your Slack workspace. Open source CLI. No DB required.

Home Page: https://hub.steampipe.io/plugins/turbot/slack

License: Apache License 2.0

Makefile 0.31% Go 99.21% PLSQL 0.48%
slack steampipe steampipe-plugin sql postgresql-fdw postgresql slack-client hacktoberfest backup etl sqlite zero-etl

steampipe-plugin-slack's Introduction

image

Slack Plugin for Steampipe

Use SQL to query infrastructure including servers, networks, identity and more from Slack.

Quick Start

Install the plugin with Steampipe:

steampipe plugin install slack

Run a query:

select email, is_admin from slack_user;

Developing

Prerequisites:

Clone:

git clone https://github.com/turbot/steampipe-plugin-slack.git
cd steampipe-plugin-slack

Build, which automatically installs the new version to your ~/.steampipe/plugins directory:

make

Configure the plugin:

cp config/* ~/.steampipe/config
vi ~/.steampipe/config/slack.spc

Try it!

steampipe query
> .inspect slack

Further reading:

Open Source & Contributing

This repository is published under the Apache 2.0 (source code) and CC BY-NC-ND (docs) licenses. Please see our code of conduct. We look forward to collaborating with you!

Steampipe is a product produced from this open source software, exclusively by Turbot HQ, Inc. It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our Open Source FAQ.

Get Involved

Join #steampipe on Slack →

Want to help but don't know where to start? Pick up one of the help wanted issues:

steampipe-plugin-slack's People

Contributors

bigdatasourav avatar bob-bot avatar cbruno10 avatar dependabot[bot] avatar e-gineer avatar giant995 avatar johnsmyth avatar lalitlab avatar madhushreeray30 avatar misraved avatar parthai avatar rajeshbal65 avatar rupeshpatil20 avatar shivani1982 avatar subhajit97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

steampipe-plugin-slack's Issues

`where..in` and `join` dont work with `slack_search`

These errors are related to turbot/steampipe-postgres-fdw#3

select
  user_name,
  timestamp,
  channel ->> 'name' as channel,
  text
from
  slack_search
where
  query in('in:#steampipe from:nathan urgent after:3/12/2021', 'in:#steampipe from:kai urgent after:3/12/2021');

  Error: internal_error
 select
  user_name,
  timestamp,
  channel ->> 'name' as channel,
  text
from
  slack_search, my_domains
where
  query = name
Error: 'List' call requires an '=' qual for column: query

Any `select * from slack_` results in `requires hydrate data` error

Describe the bug
Any select * from slack_ results in an error like:

Error: table 'slack_user' column 'workspace_domain' requires hydrate data from getCommonColumns, which failed with error missing_scope.
 (SQLSTATE HV000)

Steampipe version (steampipe -v)
v0.16.4

Plugin version (steampipe plugin list)
Slack v0.9.0

To reproduce
select * from slack_user

Expected behavior
The full list of users and their fields (although this is just based on the example provided)

Update the pagination and the limit logic for the tables

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Slack custom profile fields on the slack_user table is not populating

Describe the bug
When I run this query against my Slack workspace:

select
*
from
slack_user;

I do not get any users returning with populated data in the profile_fields column. However I know my own profile does have custom profile fields looking at my slack profile.
select * from slack_user where email = '[email protected]'
comes back profile_fields = []

Is there a bug here? Can you test on your end?

Steampipe version (steampipe -v)
steampipe version 0.13.3

Plugin version (steampipe plugin list)
Slack 0.3.0

To reproduce
Follow query above to a known user in your slack to have custom profile fields. Should not return an empty array

Expected behavior
Should be an array of key:values

Additional context
I did clear my cache, turn off cache, restarted my service, etc.

use plugin.retryHydrate

This is a query against the Steampipe public Slack that gets pretty far, then triggers a rate limit and will not complete.

with days as (
  select
    to_char(day, 'YYYY-MM-DD') as day
  from
    generate_series(date('2021-04-15'), date('2021-11-16'), '1 day') as day
),
queries as (
  select
    'in:#steampipe on:' || d.day as query
  from
    days d
),
data as (
  select
    user_name,
    user_id,
    to_char(timestamp, 'YYYY-MM-DD') as day,
    text
  from
    slack_search
  where
    query in ( (select query from queries) )
  order by 
    day 
)
select 
  day,
  count(*) as messages
from
  data 
group by
  day

Here is my first attempt to use plugin.retryHydrate: https://github.com/turbot/steampipe-plugin-slack/compare/use-retry-hydrate#diff-dd4fe9f3414fd76a85ed3ab2bc2e8896acd02d8e0687afc4599bc1bfec51059f

It seems to work, in that with this change the query will eventually complete (Time: 8m50.043227805s)

Again it gets fairly far before the rate limit kicks in. Then, there is a lot of chatter between e.g. the first line in the log extract below that returns 59 messages for a day, and the next line that returns 1 message for the following day.

If the API is going to make the plugin wait 3 seconds, would it be best to just take that wait, for example in shouldRetryError, with time.Sleep(3 * time.Second)?

I've tried that, and it also eventually completes (Time: 5m53.883121854s).

It appears that the explicit wait finishes sooner, but I'm not sure about the time comparison because the point at which rate limiting kicks in may vary from run to run.

My questions:

  • What is retryHydrate's backoff strategy? I thought it would increase the backoff when the plugin encounters resistance, but I don't think I'm seeing evidence of that here.

  • Is taking an explicit wait the right strategy here?

2021-11-16T15:53:32.858-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: returning msgs: =59
2021-11-16T15:53:32.869-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: retrying="\"\""
2021-11-16T15:53:33.009-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: api.SearchContext="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:33.009-0800 [ERROR] steampipe-plugin-slack.plugin: [ERROR] slack_search.listSearches: retry_error="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:33.110-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: retrying="\"\""
2021-11-16T15:53:33.239-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: api.SearchContext="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:33.239-0800 [ERROR] steampipe-plugin-slack.plugin: [ERROR] slack_search.listSearches: retry_error="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:33.439-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: retrying="\"\""
2021-11-16T15:53:33.578-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: api.SearchContext="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:33.578-0800 [ERROR] steampipe-plugin-slack.plugin: [ERROR] slack_search.listSearches: retry_error="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:33.879-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: retrying="\"\""
2021-11-16T15:53:34.015-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: api.SearchContext="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:34.015-0800 [ERROR] steampipe-plugin-slack.plugin: [ERROR] slack_search.listSearches: retry_error="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:34.516-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: retrying="\"\""
2021-11-16T15:53:34.657-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: api.SearchContext="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:34.657-0800 [ERROR] steampipe-plugin-slack.plugin: [ERROR] slack_search.listSearches: retry_error="slack rate limit exceeded, retry after 3s"
2021-11-16T15:53:35.457-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: retrying="\"\""
2021-11-16T15:53:35.719-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: api.SearchContext=<nil>
2021-11-16T15:53:35.719-0800 [WARN]  steampipe-plugin-slack.plugin: [WARN]  slack_search: returning msgs: =1

PS: This branch also increases the gulp size (params.Count = 100) from the default which is evidently 20.

Add workspace_domian as common column to all tables

Is your feature request related to a problem? Please describe.
When using multiple connections, it's difficult to tell which results are from which connection

Describe the solution you'd like
A common column would help differentiate rows

Describe alternatives you've considered
None

Additional context
Add any other context or screenshots about the feature request here.

Add table slack_channel

References
Add any related links that will help us understand the resource, including vendor documentation, related GitHub issues, and Go SDK documentation.

Table Access Errors: slack_access_logs and slack_search

Scopes configured as docs:

image

slack_access_log throws: Error: pq: rpc error: code = Unknown desc = paid_only - is this table not accessible on a free plan?

slack_search throws: Error: pq: rpc error: code = Internal desc = 'List' call requires an '=' qual for column: query

Would be happy to learn if I'm being stupid :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.