-
Course 4, Week 1, Assignment 1: Data Modeling with DBT
-
Description: I keep getting the following error when running the command dbt run -s star_schema at step 3.8.2. I have tried several other methods of casting the date but each have come back with the same error.
Here is the terminal output:
- coder@d5b92d2c3f0b:~/project/classicmodels_modeling$ dbt run -s star_schema
12:31:20 Running with dbt=1.8.1
12:31:21 Registered adapter: postgres=1.8.1
12:31:23 Found 7 models, 4 data tests, 664 macros
12:31:23
12:31:23 Concurrency: 1 threads (target=‘dev’)
12:31:23
12:31:23 1 of 7 START sql table model classicmodels_star_schema.dates … [RUN]
12:31:23 1 of 7 ERROR creating sql table model classicmodels_star_schema.dates … [ERROR in 0.09s]
12:31:23 2 of 7 START sql table model classicmodels_star_schema.dim_customers … [RUN]
12:31:23 2 of 7 OK created sql table model classicmodels_star_schema.dim_customers … [SELECT 122 in 0.24s]
12:31:23 3 of 7 START sql table model classicmodels_star_schema.dim_employees … [RUN]
12:31:23 3 of 7 OK created sql table model classicmodels_star_schema.dim_employees … [SELECT 23 in 0.16s]
12:31:23 4 of 7 START sql table model classicmodels_star_schema.dim_offices … [RUN]
12:31:24 4 of 7 OK created sql table model classicmodels_star_schema.dim_offices … [SELECT 7 in 0.24s]
12:31:24 5 of 7 START sql table model classicmodels_star_schema.dim_products … [RUN]
12:31:24 5 of 7 OK created sql table model classicmodels_star_schema.dim_products … [SELECT 110 in 0.12s]
12:31:24 6 of 7 START sql table model classicmodels_star_schema.fact_orders … [RUN]
12:31:24 6 of 7 OK created sql table model classicmodels_star_schema.fact_orders … [SELECT 2996 in 0.26s]
12:31:24 7 of 7 SKIP relation classicmodels_star_schema.dim_dates … [SKIP]
12:31:24
12:31:24 Finished running 7 table models in 0 hours 0 minutes and 1.41 seconds (1.41s).
12:31:24
12:31:24 Completed with 1 error and 0 warnings:
12:31:24
12:31:24 Database Error in model dates (models/star_schema/dates.sql)
invalid input syntax for type timestamp: “%Y-%m-%d”
LINE 5: ((cast(‘%Y-%m-%d’ as timestamp))::date - (cast('Y-…
^
12:31:24
12:31:24 Done. PASS=5 WARN=0 ERROR=1 SKIP=1 TOTAL=7