Giter Club home page Giter Club logo

Comments (5)

yu-iskw avatar yu-iskw commented on June 12, 2024 2

I understand the issue is caused by the lack of installation of dbt-snowflake. sqlfluff-template-dbt tried to use a dbt profile based on the configuration, but dbt-snowflake can't be found.

The issue probably haapens on any dbt adapter with dbt-core>=1.0.0. I will think of a way to install extra required packages for dbt adapters.

from action-sqlfluff.

yu-iskw avatar yu-iskw commented on June 12, 2024

@dweaver33 Thank you for the feedback. I will look into it.

from action-sqlfluff.

adeoluwaakande avatar adeoluwaakande commented on June 12, 2024

I get a similar error with dbt-bigquery:

=== [dbt templater] Sorting Nodes...
  10:49:34  Error importing adapter: No module named 'dbt.adapters.bigquery'
  Traceback (most recent call last):
    File "/usr/local/lib/python3.9/site-packages/dbt/config/profile.py", line 183, in _credentials_from_profile
      cls = load_plugin(typename)
    File "/usr/local/lib/python3.9/site-packages/dbt/adapters/factory.py", line 215, in load_plugin
      return FACTORY.load_plugin(name)
    File "/usr/local/lib/python3.9/site-packages/dbt/adapters/factory.py", line 70, in load_plugin
      raise RuntimeException(f'Could not find adapter type {name}!')
  dbt.exceptions.RuntimeException: Runtime Error
    Could not find adapter type bigquery!

from action-sqlfluff.

yu-iskw avatar yu-iskw commented on June 12, 2024

@dweaver33 @adeoluwaakande
I added a new action's input extra_requirements_txt to install your dbt adapters. As you can imagine, conflicts can occur, if the extra requirements.txt contains sqlfluff and its dependent modules. So, I would recommend you put only dbt adapter you use into it. The changes were released at v3.2.0. Please feel free to give me any feedback on it.

from action-sqlfluff.

adeoluwaakande avatar adeoluwaakande commented on June 12, 2024

@yu-iskw
Thanks for the fix. However, I get now get a parse error: Invalid numeric literal at line 1, column 5 when I run the following setup:

- uses: yu-iskw/action-sqlfluff@v3
        if: steps.check.outputs.triggered == 'true'
        id: lint-sql
        with:
          github_token: ${{ secrets.github_token }}
          reporter: github-pr-review
          sqlfluff_version: "0.11.1"
          sqlfluff_command: "lint" # Or "fix"
          config: "${{ github.workspace }}/.sqlfluff"
          paths: '${{ github.workspace }}/src/dbt/models'
          extra_requirements_txt: '${{ github.workspace }}/sqlfluff_requirements.txt'

It has been difficult for me to identify the file the error refers to. The full error is:

Running sqlfluff 🐶 ...
  ==== readout ====
  
  07:49:46  Partial parse save file not found. Starting full parse.
  Traceback (most recent call last):
    File "/usr/local/bin/sqlfluff", line 8, in <module>
      sys.exit(cli())
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
      return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
      rv = self.invoke(ctx)
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
      return __callback(*args, **kwargs)
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/cli/commands.py", line 533, in lint
      result = lnt.lint_paths(
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/linter/linter.py", line 1087, in lint_paths
      self.lint_path(
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/linter/linter.py", line 1039, in lint_path
      for i, linted_file in enumerate(runner.run(fnames, fix), start=1):
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/linter/runner.py", line 137, in run
      for lint_result in self._map(
    File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 870, in next
      raise value
    File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 125, in worker
      result = (True, func(*args, **kwds))
    File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 144, in _helper_reraises_exception
      raise ex
    File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 388, in _guarded_task_generation
      for i, x in enumerate(iterable):
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/linter/runner.py", line 54, in iter_partials
      for fname, rendered in self.iter_rendered(fnames):
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/linter/runner.py", line 43, in iter_rendered
      yield fname, self.linter.render_file(fname, self.config)
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/linter/linter.py", line 760, in render_file
      return self.render_string(raw_file, fname, config, encoding)
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/linter/linter.py", line 731, in render_string
      templated_file, templater_violations = self.templater.process(
    File "/usr/local/lib/python3.9/site-packages/sqlfluff_templater_dbt/templater.py", line 323, in process
      processed_result = self._unsafe_process(fname_absolute_path, in_str, config)
    File "/usr/local/lib/python3.9/site-packages/sqlfluff_templater_dbt/templater.py", line 541, in _unsafe_process
      TemplatedFile(
    File "/usr/local/lib/python3.9/site-packages/sqlfluff/core/templaters/base.py", line 129, in __init__
      assert (
  AssertionError
  parse error: Invalid numeric literal at line 1, column 5
 Running reviewdog 🐶 ...
  parse error: Invalid numeric literal at line 1, column 5
  reviewdog: parse error: failed to unmarshal rdjson (DiagnosticResult): proto: syntax error (line 1:1): unexpected token 

Do you have an idea of how to fix this?

from action-sqlfluff.

Related Issues (20)

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.