PedramNavid / dbtpal

Neovim plugin for dbt
93 stars 8 forks source link

Unidentified byte when running `dbt_picker()` #26

Closed cmpadden closed 4 months ago

cmpadden commented 4 months ago

A similar error has been discussed once before (https://github.com/PedramNavid/dbtpal/pull/17#issuecomment-1493688049), with a comment left stating that the error will be displayed in a pop-up. It looks like mine is still being thrown in the editor itself when running :lua require('dbtpal.telescope').dbt_picker().

Error executing vim.schedule lua callback: Vim:E474: Unidentified byte: ^[[0m04:37:13  Running with dbt=1.7.8
stack traceback:
        [C]: in function 'json_decode'
        /Users/_/workspace/dbtpal/lua/dbtpal/telescope.lua:25: in function 'entry_maker'
        ...scope.nvim/lua/telescope/finders/async_static_finder.lua:17: in function 'new_table'
        /Users/_/workspace/dbtpal/lua/dbtpal/telescope.lua:21: in function 'dbt_models'
        /Users/_/workspace/dbtpal/lua/dbtpal/telescope.lua:65: in function </Users/_/workspace/dbtpal/lua/dbtpal/telesc
ope.lua:65>

When I issue the dbt ls --resource-type=model --output=json command in the terminal directly, no error is produced, but there is some non-json text. I believe that is why the error happens.

 ❭ dbt ls --resource-type=model --output=json
04:46:29  Running with dbt=1.7.8
04:46:29  Registered adapter: duckdb=1.7.2
04:46:29  Found 2 models, 4 tests, 0 sources, 0 exposures, 0 metrics, 391 macros, 0 groups, 0 semantic models
{"name": "my_first_dbt_model", "resource_type": "model", "package_name": "dbt_duckdb_example", "original_file_path": "models/example/my_first_dbt_model.sql", "unique_id": "model.dbt_duckdb_example.my_first_dbt_model", "alias": "my_first_dbt_model", "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "table", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "depends_on": {"macros": [], "nodes": []}}
{"name": "my_second_dbt_model", "resource_type": "model", "package_name": "dbt_duckdb_example", "original_file_path": "models/example/my_second_dbt_model.sql", "unique_id": "model.dbt_duckdb_example.my_second_dbt_model", "alias": "my_second_dbt_model", "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "group": null, "materialized": "view", "incremental_strategy": null, "persist_docs": {}, "post-hook": [], "pre-hook": [], "quoting": {}, "column_types": {}, "full_refresh": null, "unique_key": null, "on_schema_change": "ignore", "on_configuration_change": "apply", "grants": {}, "packages": [], "docs": {"show": true, "node_color": null}, "contract": {"enforced": false, "alias_types": true}, "access": "protected"}, "tags": [], "depends_on": {"macros": [], "nodes": ["model.dbt_duckdb_example.my_first_dbt_model"]}}
cmpadden commented 4 months ago

Looks like adding --quiet should resolve this -- will throw up a PR shortly.

PedramNavid commented 4 months ago

Nice find -- I ended up adding this in 853d19dfb9a6f369fc8c192cad00e3ff0c3482cd