# Error when using Sequence: Object '...' does not exist or not authorized.

**URL:** <https://discourse.getdbt.com/t/error-when-using-sequence-object-does-not-exist-or-not-authorized/6064>\
**Category:** Help\
**Tags:** snowflake, dbt-cloud\
**Created:** [January 12, 2023, 1:49pm UTC](https://discourse.getdbt.com/t/error-when-using-sequence-object-does-not-exist-or-not-authorized/6064 "2023-01-12T13:49:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philipp](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@Philipp](https://discourse.getdbt.com/u/Philipp)\
**Post date:** [January 12, 2023, 1:49pm UTC](https://discourse.getdbt.com/t/error-when-using-sequence-object-does-not-exist-or-not-authorized/6064/1 "2023-01-12T13:49:17Z")

</div>

I found this [article](https://discourse.getdbt.com/t/splitting-arrays-into-rows-in-redshift-with-dbt-macros/19) referencing to this [gist](https://gist.github.com/clrcrl/58062fbbe2af91cceab0e9187a510101#file-unnest_delimited_list-sql) and tried using that macro. But I’m always getting an error on line 15 where the sequence is used. I created that sequence manually in Snowflake and made sure the permissions were set correctly. Then I also tried creating the sequence from within dbt. Creating the Sequence this way also worked without error, but still I’m getting an error when trying to use that sequence.

I’m new to dbt so possible it is something simple I’m forgetting, but the last hours of research have been without success.

In case I should share some more details let me know.  
Thanks for the support.

Philipp

---

<div class="post-metadata">

**Author:** ![a\_slack\_user](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/a_slack_user/32/1629_2.png) [@a\_slack\_user](https://discourse.getdbt.com/u/a_slack_user)\
**Post date:** [January 16, 2023, 2:32am UTC](https://discourse.getdbt.com/t/error-when-using-sequence-object-does-not-exist-or-not-authorized/6064/2 "2023-01-16T02:32:38Z")

</div>

Hey Philipp, that article is for Redshift, which didn’t (at the time of writing) have a native way to unnest json. I think that’s changed, but still a moot point since you’re using Snowflake.

On Snowflake, you should be able to use a combination of `flatten()` and the `lateral` keyword. There’s an example here: [https://community.snowflake.com/s/question/0D50Z00006uSiEUSA0/how-to-implement-unnest-function-in-snowflake](https://community.snowflake.com/s/question/0D50Z00006uSiEUSA0/how-to-implement-unnest-function-in-snowflake)

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

---

<div class="post-metadata">

**Author:** ![Philipp](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@Philipp](https://discourse.getdbt.com/u/Philipp)\
**Post date:** [January 19, 2023, 3:33pm UTC](https://discourse.getdbt.com/t/error-when-using-sequence-object-does-not-exist-or-not-authorized/6064/3 "2023-01-19T15:33:41Z")

</div>

Thanks for the feedback.

I got it working doing the following:

```auto
select my_table.*, flat_table.value as flat_value
from my_table
left join
    lateral flatten(strtok_to_array(my_table.netesd_value, ',')) as flat_table

```

---

<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:** [January 26, 2023, 3:34pm UTC](https://discourse.getdbt.com/t/error-when-using-sequence-object-does-not-exist-or-not-authorized/6064/4 "2023-01-26T15:34:32Z")

</div>

Closed on January 26, 2023, 3:34pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
