Presently, dbt debug is pretty useless. I think we should trim out a lot of the output, and instead show:
git installed?)I'm sure there are other relevant things to add here, and not all of the above are strictly necessary.
Folks who are new to dbt, or are configuring advanced functionality like custom schemas, for instance.
I'm not sure if this belongs in debug or in a separate command, but it'd be great to have a way to show what database DBT is pointed toward. Something like:
$dbt ping
DBT is connected to $db_name at host $host. DBT will create schemas with prefix $x
I'm working in multiple environments and regularly give myself mini panic-attacks when I think I've accidentally run something against production I didn't mean to.
Yesterday, I had an issue with Snowflake. The message I got was "No active warehouse selected in current session. Select an active warehouse with the 'use warehouse' command"
The problem ended up being a missing grant on the warehouse, but the log did not show whether it was attempting to use the warehouse I had defined in profiles.yml
It would be good to have more information on the connection to the DB.
Here is the relevant section of the log.
`
2018-10-14 21:36:12,473 (MainThread): Acquiring new snowflake connection "master".
2018-10-14 21:36:12,473 (MainThread): Opening a new connection (0 currently allocated)
2018-10-14 21:36:13,034 (MainThread): Using snowflake connection "master".
2018-10-14 21:36:13,034 (MainThread): On master: select distinct schema_name from information_schema.schemata
2018-10-14 21:36:13,539 (MainThread): Snowflake error: 000606 (57P03): dc8017f9-b3f3-489b-b960-1f7abf5e4565: No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.
I agree with @mikekaminsky โ I'd really like a way to test that a profile is working. Given it's one of the first things you need to set up when starting with dbt, it would be nice to be able to say something along the lines of:
run
$ dbt ping, make sure you get a successful message before going to the next step
Also not sure if it's actually part of debug or a separate command.
dbt debug options
$ dbt debug -h
usage: dbt: data build tool debug [-h] [--profiles-dir PROFILES_DIR]
[--profile PROFILE] [--target TARGET]
optional arguments:
-h, --help show this help message and exit
--profiles-dir PROFILES_DIR
Which directory to look in for the profiles.yml file.
Default = /Users/drew/.dbt
--profile PROFILE Which profile to load. Overrides setting in
dbt_project.yml.
--target TARGET Which target to load for the given profile
dbt debug usage (if everything is configured correctly)
$ dbt debug
dbt version: 0.12.1
Using profiles.yml file at: /home/drew/.dbt/profiles.yml
Configuration:
profiles.yml file [โ found and valid]
dbt_project.yml [โ found and valid]
profile: default [โ found]
target: dev [โ found]
Required dependencies:
- git [โ found]
Connection:
host: www.mydatabase.com
user: username
database: analytics
schema: dbt_dbanin
connection test: [โ connection ok]
dbt debug usage (if not run from a dbt project directory, but with a present profiles.yml file with at least one profile in it)
$ dbt debug
dbt version: 0.12.1
Using profiles.yml file at: /home/drew/.dbt/profiles.yml
Configuration:
profiles.yml file [โ found and valid]
dbt_project.yml [โ not found]
profile: default [โ found]
target: dev [โ found]
Required dependencies:
- git [โ found]
Connection:
host: www.mydatabase.com
user: username
database: analytics
schema: dbt_dbanin
connection test: [โ connection ok]
### If there is a profiles.yml file with one profile in it (and a default target)
A `dbt_project.yml` file was not found in this directory. Using the first profile `{profile}` and target `{target}`.
### If there is a profiles.yml file with more than one profile in it:
A `dbt_project.yml` file was not found in this directory. dbt found the following profiles:
- default
- redshift
To debug one of these profiles, run:
dbt debug --profile [profile-name]
dbt debug usage (with an invalid or empty profiles.yml file)
$ dbt debug
dbt version: 0.12.1
Using profiles.yml file at: /home/drew/.dbt/profiles.yml
Configuration:
profiles.yml file {[โ not found] | [โ empty] | [โ invalid]}
dbt_project.yml [โ not found]
profile: default [โ not found]
target: dev [โ not found]
Required dependencies:
- git [โ found]
dbt looked for a profiles.yml file in /Users/drew/.dbt/profiles.yml, but did not find one. For more information on configuring your profile, consult the documentation:
https://docs.getdbt.com/docs/configure-your-profile
dbt debug usage (when unable to connect to the db)
$ dbt debug
$ dbt debug
dbt version: 0.12.1
Using profiles.yml file at: /home/drew/.dbt/profiles.yml
Configuration:
profiles.yml file [โ found and valid]
dbt_project.yml [โ found and valid]
profile: default [โ found]
target: dev [โ found]
Required dependencies:
- git [โ found]
Connection:
host: www.mydatabase.com
user: username
database: analytics
schema: dbt_dbanin
connection test: [โ connection test failed]
dbt was unable to connect to the specified database. The database returned the following error:
> Snowflake error: 000606 (57P03): dc8017f9-b3f3-489b-b960-1f7abf5e4565 No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.
Check your database credentials and try again. For more information, visit:
https://docs.getdbt.com/docs/configure-your-profile
For the connection test, dbt should run a select 1 as connection_test command
Most helpful comment
dbt debug options
dbt debug usage (if everything is configured correctly)
dbt debug usage (if not run from a dbt project directory, but with a present
profiles.ymlfile with at least one profile in it)dbt debug usage (with an invalid or empty profiles.yml file)
dbt debug usage (when unable to connect to the db)
For the connection test, dbt should run a
select 1 as connection_testcommand