This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
6/17/21: We have completed maintenance for the Search functionality on the Community. If you are seeing any issues, please try to clear your cache first. If the issue persists please email Community@alteryx.com
I've been migrating data to Snowflake. I figured out how to have my local workflows output to Snowflake tables and found articles on using post-SQL to add primary keys.
For another data set, the data will already be in Snowflake, so I wanted to experiment with in-DB tools to speed up the process. Two items I have questions on:
(1) the raw data is all varchar(254). With a local workflow, I can use the Select tool or AutoField to change field types and sizes before outputting to Snowflake. The in-DB Select tool only lets me change the names. From other articles, it sounds like my only option is to use the Formula tool to change the name and then use cast (...) to change the type/size if desired? Are there other options?
(2) With the local workflow, I added post-SQL to the output tool to set the primary keys for the table. Is there a way to set primary keys when using in-DB tools? Basically, I want to read data from the raw source table, change fields names/types, add some calcs, then output to a new table and set the primary key(s) all with in-DB tools.
For (1), I meant use Formula IN-DB, so I knew about the solution you offered.
For (2), I didn't mean create a unique ID for each row, I meant designating primary key(s) in the database table. So when someone views that table in Snowflake, it will show which fields are the primary key(s). In SQL, I'd do "alter table <name> add primary key (<fields>)". This works as a post-SQL command in the regular Output tool. I don't see how to do this with in-DB tools, so wondering if there is an option?