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.

"could not cast literal to type date" error when using `in the last` for a date field

See original GitHub issue

Description

I have a date field in my data model called date. It’s been cast as a date in my .yaml

image

When I try to filter in the last on this date field, it returns an error.

https://www.loom.com/share/88b1d1ea7b19407ea478c8c66df5c22c

I’m using the pages explore in Lightdash Analytics

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
rephuscommented, Sep 21, 2022

Snowflake works, tested agains snowflake staging db

image

1reaction
TuringLovesDeathMetalcommented, Sep 21, 2022

Should we do it for all warehouses ?

BigQuery for now…and Snowflake? (if it’s a problem there too?)

Should we do it for all units of time ? (week , month, year)

I’m not sure I understand what you mean here?

When casting , what should we do ?

Option 1: include today in the “in the last” filter. It should not be included if it’s in the last x complete days though. For complete days, it should filter using option 3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL CAST Function | BigQuery Syntax and Examples - Count
Could not cast literal to type DATE ... Check the format of your string when converting to a DATE. Remember it must be...
Read more >
sql - Cast String into Date in BIGQUERY When Date is in the ...
I have a string that is a date and it is in M/D/YYYY ie: 1/1/2018 12/31/2018. I get an invalid date error (...
Read more >
Bigquery — Error: Could not cast literal "***" to type DOUBLE
If you use SAFE_CAST, value will be null. But it does not raise error. SELECT SAFE_CAST('string' as float64) AS num. Question. What is ......
Read more >
Conversion rules | BigQuery - Google Cloud
Literal conversion is evaluated at analysis time, and gives an error if the input literal cannot be converted successfully to the target type....
Read more >
Google BigQuery CAST Functions 101: Syntax and Usage ...
One rule is that the string is numeric literal and should not pass the maximum precision or the BIGNUMERIC type range unless you...
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