Start a new topic
Answered

How do I delete data during dev time?

I am in development mode. I loaded some data, then significantly changed my match rules. How do I delete the data and reload?


Best Answer

What you can do is to truncate the data to let you start afresh.

The following SQL for PostgreSQL will allow you to generate the necessary statements for all the tables related to your entity and safely remove the data. By running this it also ensures that you don't miss any of the tables.

/* Truncate statement for PostgreSQL for use during development */

select 'truncate table semarchy_dloc1.' || tablename || ';' generated_statements

from pg_catalog.pg_tables  

where schemaname = 'semarchy_dloc1'     /* set this to your data location schema */

and tablename not like 'dl_%'           /* do not truncate these system tables   */

and tablename not like 'ext_%'          /* do not truncate these system tables   */

and tablename like '%customer'          /* add filters as reqd for entities      */

order by substr(tablename,3), tablename

;


Once you have generated the truncate statements then run all of them to delete your data. 

1 Comment

Answer

What you can do is to truncate the data to let you start afresh.

The following SQL for PostgreSQL will allow you to generate the necessary statements for all the tables related to your entity and safely remove the data. By running this it also ensures that you don't miss any of the tables.

/* Truncate statement for PostgreSQL for use during development */

select 'truncate table semarchy_dloc1.' || tablename || ';' generated_statements

from pg_catalog.pg_tables  

where schemaname = 'semarchy_dloc1'     /* set this to your data location schema */

and tablename not like 'dl_%'           /* do not truncate these system tables   */

and tablename not like 'ext_%'          /* do not truncate these system tables   */

and tablename like '%customer'          /* add filters as reqd for entities      */

order by substr(tablename,3), tablename

;


Once you have generated the truncate statements then run all of them to delete your data. 

Login to post a comment