Skip to content

mySQL warnings treated as errors #177

@kzajaczkowski

Description

@kzajaczkowski

Describe the bug

If a model SQL query gets warning from mysql engine. The dbt model processing fails with error instead of succeeding with warning.

Steps To Reproduce

Create the following model named stg_test.

{{
  config(
    materialized = "table"
  )
}}

SELECT STR_TO_DATE(
           'Just a dummy string',
            '%d/%m/%y %h:%i %p'
        ) AS col1

Run

dbt run --select stg_test

You will get the following error

Database Error in model stg_test (***/stg_test.sql)
  1411 (HY000): Incorrect datetime value: 'Just a dummy string' for function str_to_date
  compiled Code at target/run/***/stg_test.sql

When you run the same query in mysql, it succeeds and gives just a warning.

Expected behavior

I would expect the model to return success with warning if mysql runs the query successfully.

Screenshots and log output

image

The output of dbt --version:

Core:
  - installed: 1.7.17
  - latest:    1.8.9  - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - mysql:   1.7.0 - Up to date!
  - mysql5:  1.7.0 - Could not determine latest version
  - mariadb: 1.7.0 - Could not determine latest version

The operating system you're using:
macOS / docker

The output of python --version:
Python 3.11.9

Additional context

I am not sure if this is a bug or by design, but wasn't able to find any documentation on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions