# Macro for sanitizing CSV

**URL:** <https://discourse.getdbt.com/t/macro-for-sanitizing-csv/5454>\
**Category:** Help\
**Created:** [December 1, 2022, 12:39pm UTC](https://discourse.getdbt.com/t/macro-for-sanitizing-csv/5454 "2022-12-01T12:39:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrvoje](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/hrvoje/32/2275_2.png) [@hrvoje](https://discourse.getdbt.com/u/hrvoje)\
**Post date:** [December 1, 2022, 12:39pm UTC](https://discourse.getdbt.com/t/macro-for-sanitizing-csv/5454/1 "2022-12-01T12:39:14Z")

</div>

I have CSV with one column:

```auto
tradehour
2022-11-21 18:00:00
2022-11-21 19:00:00
2022-11-21 20:00:00
2022-11-21 21:00:00

```

I’ll use this to iterate over hours to do backfill with backfill model.

When I run dbt seed I get:

```auto
12:32:20 Database Error in seed frame-report-backfill-hrs (seeds/frame-report-backfill-hrs.csv)
12:32:20 001003 (42000): SQL compilation error:
12:32:20 syntax error line 1 at position 50 unexpected '-'.

```

Even If I put those records in single or double quotations - I get same error.  
What would be proper way of sanitizing this data so it can be properly loaded as single column table?  
How can I run some macro to do that automatically?  
I would like to just copy paste those timestamps , run macro and have CSV sanitized.  
I don’t need full solutions just few pointers.  
Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/1X/a7a7ca1fe379aaf90952b0e13118a817babcd14f.png) [@system](https://discourse.getdbt.com/u/system)\
**Post date:** [December 2, 2022, 1:04am UTC](https://discourse.getdbt.com/t/macro-for-sanitizing-csv/5454/2 "2022-12-02T01:04:03Z")

</div>

You should be able to specify that these are datetimes in your dbt\_project.yml: [https://docs.getdbt.com/faqs/seeds/seed-datatypes](https://docs.getdbt.com/faqs/seeds/seed-datatypes)

if not, you could fall back to creating it as a string column and then transform it further in a dbt staging model, but that feels like it should be unnecessary

Note: `@joellabes (dbt Labs)` originally [posted this reply in Slack](https://getdbt.slack.com/archives/CCKAGDE0M/p1669943038345559?thread_ts=1669898375.447309&cid=CCKAGDE0M). It might not have transferred perfectly.
