Repository: aws/aws-sdk-pandas

Issue #1454: TypeError: ClientError.__init__() missing 1 required positional argument: 'operation_name'
Created: 2022-07-18T09:40:52Z
Describe the bug
Type error when running a sql query on an RDS DB using Data API.
How to Reproduce
import awswrangler as wr

con_rds = wr.data_api.rds.connect(
    resource_arn=r_arn,
    database=db_name,
    secret_arn=s_arn
)

df = wr.data_api.rds.read_sql_query(
    sql="SELECT * FROM some_table",
    con=con_rds,
)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [10], in <cell line: 10>()
      1 import awswrangler as wr
      4 con_rds = wr.data_api.rds.connect(
      5     resource_arn=r_arn,
      6     database=db_name,
      7     secret_arn=s_arn
      8 )
---> 10 df = wr.data_api.rds.read_sql_query(
     11     sql="SELECT * FROM some_table",
     12     con=con_rds,
     13 )

File /opt/conda/envs/ml10/lib/python3.10/site-packages/awswrangler/data_api/rds.py:162, in read_sql_query(sql, con, database)
    146 def read_sql_query(sql: str, con: RdsDataApi, database: Optional[str] = None) -> pd.DataFrame:
    147     """Run an SQL query on an RdsDataApi connection and return the result as a dataframe.
    148 
    149     Parameters
   (...)
    160     A Pandas dataframe containing the query results.
    161     """
--> 162     return con.execute(sql, database=database)

File /opt/conda/envs/ml10/lib/python3.10/site-packages/awswrangler/data_api/connector.py:27, in DataApiConnector.execute(self, sql, database)
     15 def execute(self, sql: str, database: Optional[str] = None) -> pd.DataFrame:
     16     """Execute SQL statement against a Data API Service.
     17 
     18     Parameters
   (...)
     25     A Pandas DataFrame containing the execution results.
     26     """
---> 27     request_id: str = self._execute_statement(sql, database=database)
     28     return self._get_statement_result(request_id)

File /opt/conda/envs/ml10/lib/python3.10/site-packages/awswrangler/data_api/rds.py:91, in RdsDataApi._execute_statement(self, sql, database)
     89 if response is None:
     90     self.logger.exception("Maximum BadRequestException retries reached for query %s", sql)
---> 91     raise self.client.exceptions.BadRequestException(
     92         f"Query failed - BadRequestException received after {total_tries} tries and sleeping {total_sleep}s"
     93     ) from last_exception
     95 request_id: str = uuid.uuid4().hex
     96 self.results[request_id] = response

TypeError: ClientError.__init__() missing 1 required positional argument: 'operation_name'

Expected behavior
No response
Your project
No response
Screenshots
No response
OS
Amazon SageMaker Studio (see additional context)
Python version
3.10.5
AWS DataWrangler version
2.16.1
Additional context
Amazon SageMaker
Image: Data Science 1.0 (Anaconda)
Instance type: ml.t3.medium
custom conda environment with Python 3.10.5 installed (all latest packages through conda-forge)

Duplicate issue #1510: TypeError: __init__() missing 1 required positional argument: 'operation_name'
Created: 2022-08-09T01:43:00Z
Describe the bug
I got this error when trying to execute a query from RdsDataApi.
How to Reproduce
`import awswrangler as wr
rds = wr.data_api.rds.RdsDataApi(
resource_arn= 'my_arn',
database= 'my_db',
secret_arn= 'my_arn_secret'
)
rds.execute('select * from pg_tables;')
`

TypeError                                 Traceback (most recent call last)
Input In [146], in <cell line: 1>()
----> 1 rds.execute('select * from pg_tables;')
File /opt/conda/envs/myenv/lib/python3.9/site-packages/awswrangler/data_api/connector.py:27, in DataApiConnector.execute(self, sql, database)
15 def execute(self, sql: str, database: Optional[str] = None) -> pd.DataFrame:
16     """Execute SQL statement against a Data API Service.
17
18     Parameters
(...)
25     A Pandas DataFrame containing the execution results.
26     """
---> 27     request_id: str = self._execute_statement(sql, database=database)
28     return self._get_statement_result(request_id)
File /opt/conda/envs/myenv/lib/python3.9/site-packages/awswrangler/data_api/rds.py:91, in RdsDataApi._execute_statement(self, sql, database)
89 if response is None:
90     self.logger.exception("Maximum BadRequestException retries reached for query %s", sql)
---> 91     raise self.client.exceptions.BadRequestException(
92         f"Query failed - BadRequestException received after {total_tries} tries and sleeping {total_sleep}s"
93     ) from last_exception
95 request_id: str = uuid.uuid4().hex
96 self.results[request_id] = response
TypeError: init() missing 1 required positional argument: 'operation_name'
Expected behavior
No response
Your project
No response
Screenshots
No response
OS
na
Python version
3.9.12
AWS DataWrangler version
2.16.1
Additional context
Using:

Sagemaker Studio
Custom image (conda environment - Python 3.9.12)

Closing comment (2022-08-09T09:38:15Z): Duplicate of #1454