Paste raw SQL and get a starting dbt model — table references swapped for ref()/source() macros, plus a schema.yml stub with your columns listed.
FROM/JOIN table references and the SELECT column list, while correctly ignoring CTE names defined in a WITH clause.ref(), wrap it in source(), or leave it exactly as written. We can't know which tables are already dbt models vs. raw sources — that's your call.AS alias are listed exactly; bare column references use their own name; anything more complex (an un-aliased expression, or SELECT *) gets a TODO flag since we can't always know the exact output column name.;).