# Getting syntax error when using source() and ref()

**URL:** <https://discourse.getdbt.com/t/getting-syntax-error-when-using-source-and-ref/15236>\
**Category:** Help\
**Tags:** dbt-core\
**Created:** [September 3, 2024, 8:17am UTC](https://discourse.getdbt.com/t/getting-syntax-error-when-using-source-and-ref/15236 "2024-09-03T08:17:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jomeltapawan](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@jomeltapawan](https://discourse.getdbt.com/u/jomeltapawan)\
**Post date:** [September 3, 2024, 8:17am UTC](https://discourse.getdbt.com/t/getting-syntax-error-when-using-source-and-ref/15236/1 "2024-09-03T08:17:21Z")

</div>

Hello! I could really use some help, this one part is preventing me from moving forward in my project and has been very frustrating. I get a syntax error, “Incorrect syntax near ‘‘films’’. Expecting ‘(’, or SELECT.” when I use the ref(‘films’) part in my code. Same goes for the source() function. SELECT \* FROM {{ source(‘destination\_db’, ‘actors’) }}. With that code I get the same syntax error. each of the sql files are all in the models/examples directory. It may also be worth noting that I am using dbt with docker. here is the full code:  
WITH films\_with\_ratings AS (  
SELECT  
film\_id,  
title,  
release\_date,  
price,  
rating,  
user\_rating,  
CASE  
WHEN user\_rating \>= 4.5 THEN ‘Excellent’  
WHEN user\_rating \>= 4.0 THEN ‘Good’  
WHEN user\_rating \>= 3.0 THEN ‘Average’  
ELSE ‘Poor’  
END AS rating\_category  
FROM {{ ref(‘films’) }}  
)  
…  
Any help is appreciate!!

p.s I am use dbt 1.8

---

<div class="post-metadata">

**Author:** ![DataNath](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/datanath/32/4070_2.png) [@DataNath](https://discourse.getdbt.com/u/DataNath)\
**Post date:** [September 3, 2024, 10:07pm UTC](https://discourse.getdbt.com/t/getting-syntax-error-when-using-source-and-ref/15236/2 "2024-09-03T22:07:32Z")

</div>

Hey @jomeltapawan, not sure if it’s just occurred when pasting over the code but your code contains curly quotes. If this is how it actually looks, it ought to be:

```auto
WITH films_with_ratings AS (
    SELECT
        film_id,
        title,
        release_date,
        price,
        rating,
        user_rating,
        CASE
            WHEN user_rating >= 4.5 THEN 'excellent'
            WHEN user_rating >= 4.0 THEN 'good'
            WHEN user_rating >= 3.0 THEN 'average'
            ELSE 'poor'
        END AS rating_category
    FROM
        {{ ref('films') }}
)
SELECT
    *
FROM
    films_with_ratings

```

Using “'” instead.
