ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
解決済み

Dropping lines of data in a SQL table?

zachwalz
メテオール

Hey all--

 

Is there any smooth/easy way to drop lines of data in a SQL table using Alteryx? The only solution I've come up with is to filter out data I don't want and rewrite tables... but that doesn't work well with in-DB tools if you're reading/rewriting the same table.

 

Any thoughts?

 

-Zach

4件の返信4
rdoptis
ボリード

With the traditional input / output tools, DELETE FROM statements can be placed in the pre/post SQL boxes. This is the most convienient place I have found to execute DML statements for which Alteryx doesn't have a dedicated tool for.

 

Ryan

zachwalz
メテオール

Thanks, rdoptis! Do you know if there is a way to create a variable in Alteryx to be used in that statement? E.g.

 

DELETE FROM tablename

WHERE id IN ([Alteryx Variable Here])

zachwalz
メテオール

Actually, I think I figured it out:

 

If I create a dummy table with the rows to delete, I can then put a post-create SQL statement with the DELETE FROM with an IN condition using the dummy table data. I then drop the dummy table in the same post-creat SQL statement :).

 

Thanks for your advice!!!

-Zach

rdoptis
ボリード

Cool - nice work. 

 

The pre/post can be very powerful. Also note the pre-SQL is executed every time the tool config is changed as Alteryx wants to have the best downstream metadata (EX: what fields are available, datatypes, etc). With this, watch out when putting certian types of DML in there such as DELETEs.

 

 

Cheers,

Ryan

ラベル
トップのソリューション投稿者