awslabs / awslabs/amazon-redshift-utils

Error if 'destinationTableForceDropCreate' is TRUE but table not present

Open
#497 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

When running with params set to force drop and recreate on a first-time run with a fresh target DB, this fails since it finds no table to drop.

https://github.com/awslabs/amazon-redshift-utils/blob/d2aa42a6ff872164613af027543efdfe5d517dbe/src/UnloadCopyUtility/util/tasks.py#L185-L189

Combining the conditional statements worked:
`if config_parameters['destinationTableForceDropCreate'] and self.target_resource.is_present():`

I guess the other option is to not set params to force the drop/create, but there are situations where this could result in the opposite problem: some tables in the schema that should be recreated are not.

Contributor guide

Open the contributing guide

Research direction

Start in src/UnloadCopyUtility/util/tasks.py at lines 185-189 and reproduce a first-time run with destinationTableForceDropCreate enabled against a fresh target database. Done means the force-drop/recreate path no longer fails when the destination table is absent, while tables that are present can still be recreated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.