Remove SQL header

Running dbt version 15.2 for snowflake WH.
For one specific condition I need to remove default create table ( SQL header ) from that specific model.
Question : -

  1. In DBT we have option to remove SQL header right ?
  2. If Yes, please provide some more information that how we can do it. I tried to that with the help of this documentation ( sql_header | dbt Docs ) but sadly its not working.

Thanks
Saini

Hey @Talwindersaini - are you referring to the create or replace table ... as ( part of the compiled query that dbt executes? If so, that isn’t a SQL Header – it’s provided by the configured materialization.

Maybe if you told us a little more about your use case, we’d be able to point you in the right direction

Yes @drew, I’m referring to the create or replace table ... as .

As per my requirements I need to create dynamic queries for tables.
Therefore, I don’t need that header ( create or replace table ... as ) in compiled query.

actual output: -
CREATE OR REPLACE TABLE model_name as (
CREATE OR REPLACE TABLE test1 as ( select col1,col2 from test);
CREATE OR REPLACE TABLE test2 as ( select col3,col4 from test);
);

required output : -
CREATE OR REPLACE TABLE test1 as ( select col1,col2 from test);
CREATE OR REPLACE TABLE test2 as ( select col3,col4 from test);

Ok, got it, thanks for that.

Maybe have a look at something like https://docs.getdbt.com/docs/building-a-dbt-project/using-operations/?

Models can be:

  • selected from using ref in other models
  • tested
  • documented

If you’re trying to create multiple tables from inside of a single model, it’s not really clear how these things (ref’ing, testing, documenting, etc) should work! I’d definitely recommend considering an alternative approach here.