I’m using dbt with VS Code to build a model on BigQuery. I’m encountering the following error:
Syntax error: Illegal input character "\303" at [24:15]
This is my script. I’ve already tried the following steps:
-
Checked the code for any non-printable or hidden characters.
-
Ensured that my file is saved with UTF-8 encoding.
-
Removed any special formatting by copying the code to a plain text editor.
{{ config(
tags=["PII", "LAGERL23B"],
materialized="table"
) }}
WITH
-- Quell-Daten laden und alle Transformationen in einer einzigen CTE durchführen
Extraktion_Details AS (
SELECT
*,
CONCAT(
SUBSTRING(CAST(Artikelfarbennummer AS STRING), 1, 2), '-',
SUBSTRING(CAST(Artikelfarbennummer AS STRING), 3, 4), '/',
SUBSTRING(CAST(Artikelfarbennummer AS STRING), 7, 2)
) AS Artikelnummer,
SUBSTRING(CAST(Artikelfarbennummer AS STRING), 7, 2) AS Farbnummer,
SUBSTRING(CAST(Artikelfarbennummer AS STRING), 1, 6) AS Artikelnummer_ohne_Farbe,
SUBSTRING(CAST(FORM8 AS STRING), 1, 2) AS PROD2
FROM {{ ref("stg_LAGERL23B") }} AS LAGERL23B
),
Neuer_Schlüssel AS (
SELECT
*,
CONCAT(Kundennummer, '_', PROD2) AS Key_Kunde
FROM Extraktion_Details
)
-- Finaler Output
SELECT COUNT(*)
FROM Neuer_Schlüssel
2
Answers
The umlaut in your alias is causing an issue. You can remove/replace it or wrap the alias in tickmarks if you prefer to keep it:
The German language characters ä, ö and ü are not recognized by dbt. repalce ü with ue in your CTE.