The result of most of Netezza’s analytic functions are a series of tables. The tables produced vary from function to function. We schedule jobs to run the analytic functions and want to reuse the same model name so that our business intelligence tools can simply query the resulting tables. Identifying the tables and dropping them manually is an option; so is using symbolic links and generating a new model every day.
Instead, Netezza provides a very easy way to do clean up an existing model using their drop_model function. It takes a single parameter:model. For example:
FOO(ADMIN)=> call nza..arule('model=mbasket, intable=pos_txn_dtl, tid=customerid, item=productid, support=10, supportType=absolute, maxsetsize=3); ERROR: The view NZA_META_PRIV_MBASKET already exists. Choose another model name.
Here my analytic function failed because the model already existed. To remove all of the results this previous execution created I run the following:
FOO(ADMIN)=> call nza..drop_model('model=mbasket'); NOTICE: Dropped: MBASKET DROP_MODEL ------------ t (1 row)
Now I can rerun my analytic function without having to worry about existing tables.