@mock.patch('airflow.providers.apache.hive.hooks.hive.HiveServer2Hook.get_pandas_df', return_value=pd.DataFrame(data=[('1', 'sid'), ('1', 'gupta')], columns=['id', 'name']))
@unittest.skipIf((mock_dynamodb2 is None), 'mock_dynamodb2 package not present')
@mock_dynamodb2
def test_pre_process_records_with_schema(self, mock_get_pandas_df):
    self.hook.get_conn().create_table(TableName='test_airflow', KeySchema=[{'AttributeName': 'id', 'KeyType': 'HASH'}], AttributeDefinitions=[{'AttributeName': 'id', 'AttributeType': 'S'}], ProvisionedThroughput={'ReadCapacityUnits': 10, 'WriteCapacityUnits': 10})
    operator = airflow.providers.amazon.aws.operators.hive_to_dynamodb.HiveToDynamoDBTransferOperator(sql=self.sql, table_name='test_airflow', task_id='hive_to_dynamodb_check', table_keys=['id'], pre_process=self.process_data, dag=self.dag)
    operator.execute(None)
    table = self.hook.get_conn().Table('test_airflow')
    table.meta.client.get_waiter('table_exists').wait(TableName='test_airflow')
    self.assertEqual(table.item_count, 1)
@mock.patch('airflow.providers.apache.hive.hooks.hive.HiveServer2Hook.get_pandas_df', return_value=pd.DataFrame(data=[('1', 'sid'), ('1', 'gupta')], columns=['id', 'name']))
@unittest.skipIf((mock_dynamodb2 is None), 'mock_dynamodb2 package not present')
@mock_dynamodb2
def test_pre_process_records_with_schema(self, mock_get_pandas_df):
    self.hook.get_conn().create_table(TableName='test_airflow', KeySchema=[{'AttributeName': 'id', 'KeyType': 'HASH'}], AttributeDefinitions=[{'AttributeName': 'id', 'AttributeType': 'S'}], ProvisionedThroughput={'ReadCapacityUnits': 10, 'WriteCapacityUnits': 10})
    operator = airflow.providers.amazon.aws.operators.hive_to_dynamodb.HiveToDynamoDBTransferOperator(sql=self.sql, table_name='test_airflow', task_id='hive_to_dynamodb_check', table_keys=['id'], pre_process=self.process_data, dag=self.dag)
    operator.execute(None)
    table = self.hook.get_conn().Table('test_airflow')
    table.meta.client.get_waiter('table_exists').wait(TableName='test_airflow')
    self.assertEqual(table.item_count, 1)