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 snowflake session, schemata, login_history and account_parameter table; Add common columns account and region to all tables; Add warehouse connection config argument #2

Merged
merged 33 commits into from
Apr 4, 2022

Conversation

LalitLab
Copy link
Contributor

Example query results

Results
select distinct
  user_name,
  authentication_method,
  client_environment ->> 'APPLICATION' as clint_application
from
  snowflake_session
where
  split_part(authentication_method, '+', 2) = ''
  and authentication_method like 'Password%'
  and created_on > now() - interval '30 days'
order by
  user_name desc;
+-----------+-----------------------+-------------------+
| user_name | authentication_method | clint_application |
+-----------+-----------------------+-------------------+
| STEAMPIPE | Password              | Go                |
| STEAMPIPE | Password              | STEAMPIPE         |
| STEAMPIPE | Password              | SnowSQL           |
| STEAMPIPE | Password              | <null>            |
+-----------+-----------------------+-------------------+

@LalitLab LalitLab self-assigned this Mar 30, 2022
@LalitLab LalitLab changed the title Add snowflake session, schemata, login_history and account_parameter table Add snowflake session, schemata, login_history and account_parameter table; Add common columns account and region to all tables; Add warehouse connection config argument Mar 30, 2022
Copy link
Contributor

@cbruno10 cbruno10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LalitTurbot Please see comments, thanks!

Database: database,
Schema: schema,
Warehouse: warehouse,
Application: "STEAMPIPE",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this shouldn't be STEAMPIPE for all users? What is the Application used for? Do we need a config arg for it?

CHANGELOG.md Outdated
_Enhancements_

- Added `account` and `region` metadata column to all existing tables.
- Changed the column type of `ext_authn_duo` column from string to bool in `snowflake_user` table.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be under the _Bug fixes_ section instead, assuming it was always meant to be a bool instead of string type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snowflake stores ext_authn_duo as string true or false. Hence changed column type to Bool from String for easier handling in queries.

CHANGELOG.md Outdated Show resolved Hide resolved
config/snowflake.spc Outdated Show resolved Hide resolved
docs/index.md Outdated Show resolved Hide resolved
@@ -82,6 +82,16 @@ func connect(ctx context.Context, d *plugin.QueryData) (*sql.DB, error) {
if config.OAuthAccessToken != nil {
oauthAccessToken = *config.OAuthAccessToken
}
// TODO - Required to query general tables through steampipe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we're planning on adding soon? What's the result of us not having arg support for these yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, If someone requests to query snowflake tables using steampipe

snowflake/plugin.go Show resolved Hide resolved
snowflake/table_snowflake_account_parameter.go Outdated Show resolved Hide resolved
snowflake/table_snowflake_schemata.go Outdated Show resolved Hide resolved
snowflake/table_snowflake_schemata.go Outdated Show resolved Hide resolved
@cbruno10 cbruno10 merged commit 6e243aa into main Apr 4, 2022
@cbruno10 cbruno10 deleted the add_new_tables branch April 4, 2022 20:58
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.

None yet

2 participants