Execute Redshift statement synchronously. Waits for the query to finish. Raises RedshiftCredentialsError if the statement couldn't be executed due to the validation error. Raises RedshiftQueryError if the query runs but finishes with errors. Args: redshift_data_client: Redshif
(
redshift_data_client,
cluster_id: Optional[str],
workgroup: Optional[str],
database: str,
user: Optional[str],
query: str,
)
| 147 | |
| 148 | |
| 149 | def execute_redshift_statement( |
| 150 | redshift_data_client, |
| 151 | cluster_id: Optional[str], |
| 152 | workgroup: Optional[str], |
| 153 | database: str, |
| 154 | user: Optional[str], |
| 155 | query: str, |
| 156 | ) -> str: |
| 157 | """Execute Redshift statement synchronously. Waits for the query to finish. |
| 158 | |
| 159 | Raises RedshiftCredentialsError if the statement couldn't be executed due to the validation error. |
| 160 | Raises RedshiftQueryError if the query runs but finishes with errors. |
| 161 | |
| 162 | |
| 163 | Args: |
| 164 | redshift_data_client: Redshift Data API Service client |
| 165 | cluster_id: Redshift Cluster Identifier |
| 166 | workgroup: Redshift Serverless Workgroup |
| 167 | database: Redshift Database Name |
| 168 | user: Redshift username |
| 169 | query: The SQL query to execute |
| 170 | |
| 171 | Returns: Statement ID |
| 172 | |
| 173 | """ |
| 174 | statement = execute_redshift_statement_async( |
| 175 | redshift_data_client, cluster_id, workgroup, database, user, query |
| 176 | ) |
| 177 | wait_for_redshift_statement(redshift_data_client, statement) |
| 178 | return statement["Id"] |
| 179 | |
| 180 | |
| 181 | def get_redshift_statement_result(redshift_data_client, statement_id: str) -> dict: |
no test coverage detected