Repository: great-expectations/great_expectations

Issue:
Teradata support: Temporary tables can't be created in SqlAlchemyBatchData
**Describe the bug**
When using a Teradata connector, Temporary tables can't be created.
Error: `OperationalError: [Version 17.10.0.2] [Session 18642302] [Teradata Database] [Error 3707] Syntax error, expected something like a 'METHOD' keyword between the 'CREATE' keyword and the 'TEMPORARY' keyword.`

Looking at the stack trace the error is thrown when calling `SqlAlchemyBatchData:_create_temporary_table`. This class is not patched when implementing the Teradata support feature #3496 
@imamolp I would really appreciate it if you could have a look at that. 

**To Reproduce**
Steps to reproduce the behavior:
1. Configure data source
```yaml
datasources:
  project_teradata:
    module_name: great_expectations.datasource
    data_connectors:
      default_runtime_data_connector_name:
        class_name: RuntimeDataConnector
        module_name: great_expectations.datasource.data_connector
        batch_identifiers:
          - default_identifier_name
      default_inferred_data_connector_name:
        class_name: InferredAssetSqlDataConnector
        module_name: great_expectations.datasource.data_connector
    execution_engine:
      module_name: great_expectations.execution_engine
      connection_string: ${connection_string}
      class_name: SqlAlchemyExecutionEngine
    class_name: Datasource
```
2. Create expectation
```json
{
  "data_asset_type": null,
  "expectation_suite_name": "bandwidth_cluster_ref_warnings",
  "expectations": [
    {
      "expectation_type": "expect_column_values_to_not_be_null",
      "ge_cloud_id": null,
      "kwargs": {
        "column": "Bandwidth_Volume"
      },
      "meta": {}
    }
  ],
  "ge_cloud_id": null,
  "meta": {
    "great_expectations_version": "0.13.43"
  }
}
```
3. Create a checkpoint for that expectation
4. When execute the line `context.run_checkpoint(checkpoint_name=my_checkpoint_name)` the exception is thrown.

**Expected behavior**
Checkpoint is executed without exception. The temporary table can be created and dropped after execution without exception.

**Environment (please complete the following information):**
 - Operating System: Windows 10
 - Great Expectations Version: 0.13.43
 - Python Version: 3.8.3
 - Terdata Version: 16.20.53.35
 - SQLAlchemy Version: 1.3.18

**Additional context**




Discussion:
@rafaelkrysciak Thank you for pointing this out. I will raise PR for this.

Resolving patch:
diff --git a/great_expectations/execution_engine/sqlalchemy_batch_data.py b/great_expectations/execution_engine/sqlalchemy_batch_data.py
--- a/great_expectations/execution_engine/sqlalchemy_batch_data.py
+++ b/great_expectations/execution_engine/sqlalchemy_batch_data.py
@@ -250,6 +250,11 @@ def _create_temporary_table(
             stmt_2 = "CREATE GLOBAL TEMPORARY TABLE {temp_table_name} ON COMMIT PRESERVE ROWS AS {query}".format(
                 temp_table_name=temp_table_name, query=query
             )
+        # Please note that Teradata is currently experimental (as of 0.13.43)
+        elif self.sql_engine_dialect.name.lower() == "teradatasql":
+            stmt = 'CREATE VOLATILE TABLE "{temp_table_name}" AS ({query}) WITH DATA NO PRIMARY INDEX ON COMMIT PRESERVE ROWS'.format(
+                temp_table_name=temp_table_name, query=query
+            )
         else:
             stmt = 'CREATE TEMPORARY TABLE "{temp_table_name}" AS {query}'.format(
                 temp_table_name=temp_table_name, query=query


Test patch: