question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unparsing error on a date function

See original GitHub issue

Search before asking

  • I searched the issues and found no similar issues.

What Happened

I’ve tried to reproduce lint, but it give me an unparsing error.

Expected Behaviour

I was expecting the tool to tell me about possible errors in the .sql.

Observed Behaviour

The tool gave me an unparsing error concerning a basic date function from Big Query

extract(week(monday) from date)

Log:

=== [dbt templater] Sorting Nodes...
=== [dbt templater] Compiling dbt project...
=== [dbt templater] Project Compiled.
== [models\marts\yaigo\weekly\weekly_partner_collection.sql] FAIL
L:  21 | P:  14 |  PRS | Line 17, Position 14: Found unparsable section:
                       | '(week(monday) from orders.fecha_entrega)...'
WARNING: Parsing errors found and dialect is set to 'bigquery'. Have you configured your dialect correctly?

How to reproduce

Running sqlfluff lint, because the fix statement doesn’t recognize the error on the .sql

Dialect

dialect = bigquery
templater = dbt

Version

python 3.9.12
sqlfluff == 1.3.0
sqlfluff-templater-dbt == 1.3.0
dbt-core == 1.3.0
dbt-bigquery == 1.3.0

Configuration

[sqlfluff]
templater = dbt
dialect = bigquery
rules = L001, L002, L006, L011, L023, L024, L035, L039, L041
encoding = utf-8

[sqlfluff:rules]
capitalisation_policy = lower
tab_space_size = 2
indent_unit = space

[sqlfluff:indentation]
indented_joins = true
indented_using_on = true

[sqlfluff:templater:jinja]
apply_dbt_builtins = true

[sqlfluff:templater:jinja:macros]
dbt_ref = {% macro ref(model_ref) %}{{model_ref}}{% endmacro %}
dbt_source = {% macro source(source_name, table) %}{{source_name}}_{{table}}{% endmacro %}

[sqlfluff:templater:dbt]
project_dir = .
profile_dir = ./.

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Shrppcommented, Oct 14, 2022

However, I don’t think the fix is necessary. I just updated SQLFluff (both CLI and Git Hub Actions) and it works perfectly now

0reactions
Shrppcommented, Oct 14, 2022

Those lines are the problem, the lines beside are ids

Read more comments on GitHub >

github_iconTop Results From Across the Web

DateFormat Parsing Error - java - Stack Overflow
What you want to do is parse the incoming format to a Date object final SimpleDateFormat idf = new SimpleDateFormat("MM/dd/yyyy"); final Date indate ......
Read more >
Error 'failed to parse date' for Date Time Field with Data Loader
Valid formatting for Date/Time fields in the API are documented in the following resources:Format the 'Date' and 'Date Time' data in a CSV...
Read more >
date formula parse error depends of "locale" setting of the ...
Inputing the formula =DATE(yyyy,mm,dd) as described you could encounter the parse error warning if you changed the locale setting of the ...
Read more >
Solved: Date to Day ->Parse Error at char(0): Formula: tri...
I've read somewhere could be because previous data is string. The date is extract out using Regex and then convert using DateTime tool....
Read more >
Formula Parse Errors In Google Sheets And How To Fix Them
This formula parse error typically occurs when your formula is expecting a certain data type as an input but receives the wrong type,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found