Home > other >  How to check if a aws redshift table is present or not
How to check if a aws redshift table is present or not

Time:09-17

I have an use case where I need to do the followings:

1.Check if redshift_db.redhsift_tbl is present or not? If table is present then perform operation A else perform operation B.

I was checking in boto3 documentation to get an api which will tell whether or not the table is present but no luck. What is the best way to check whether a redshift table is present or not?

CodePudding user response:

There are 2 ways you can go. If you are using an external orchestration tool then this tool can query the catalog tables (pg_table_def or stv_tbl_perm) and issue the appropriate next commands based on the result. Or if you need Redshift to do this then you will need create a stored procedure to take the correct action based on examining the catalog tables.

  • Related