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

make the debug subcommand actually useful #1061

Closed
drewbanin opened this issue Oct 14, 2018 · 4 comments
Closed

make the debug subcommand actually useful #1061

drewbanin opened this issue Oct 14, 2018 · 4 comments
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!
Milestone

Comments

@drewbanin
Copy link
Contributor

Feature

Feature description

Presently, dbt debug is pretty useless. I think we should trim out a lot of the output, and instead show:

  1. Expected path to profiles.yml (given CLI args, env vars, etc)
  2. Whether or not that profiles.yml actually exists (and is valid)
  3. Whether or not dbt_project.yml exists (and is valid)
  4. Whether or not certain dependencies are met (eg. is git installed?)
  5. Whether or not dbt can connect to the target database?
  6. A list of available targets
  7. A list of schemas that dbt will build into (?)

I'm sure there are other relevant things to add here, and not all of the above are strictly necessary.

Who will this benefit?

Folks who are new to dbt, or are configuring advanced functionality like custom schemas, for instance.

@drewbanin drewbanin added enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors! labels Oct 14, 2018
@mikekaminsky
Copy link
Contributor

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.

@pedromachados
Copy link

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.
``

@clrcrl
Copy link
Contributor

clrcrl commented Nov 27, 2018

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.

@drewbanin drewbanin added this to the Wilt Chamberlain milestone Nov 28, 2018
@drewbanin
Copy link
Contributor Author

drewbanin commented Dec 3, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!
Projects
None yet
Development

No branches or pull requests

5 participants