Repository: great-expectations/great_expectations

Issue:
QueryBatchKwargsGenerator._get_raw_query produces incorrect filepath
I am using the `QueryBatchKwargsGenerator` to generate `BATCH_KWARGS` using a SQL file I have stored on disk. My `great_expectations.yml` looks like:

```yaml
datasources:
    domi:
      class_name: SqlAlchemyDatasource
      module_name:
      data_asset_type:
        class_name: SqlAlchemyDataset
      credentials:
        drivername: postgres
        host: ${HOST}
        port: ${PORT}
        username: ${USER}
        password: ${PASSWORD}
        database: ${DBNAME}
      generators:
        apartments-generator:
          class_name: QueryBatchKwargsGenerator
          name: apartments
```

I am running the following:

```python
>>> import great_expectations as get

>>> context = ge.data_context.DataContext()
>>> context.get_available_data_asset_names()
{'domi': {'apartments-generator': {'names': [('listings', 'query')]}}}

>>> context.build_batch_kwargs(
    datasource='domi', generator='apartments-generator', name='listings'
)
```

Which raises this error:

![image](https://user-images.githubusercontent.com/11096727/79018747-8e14b080-7b42-11ea-9564-7b35b23dac72.png)

This happens because `_get_raw_query` is doing `tuple('listings')` which returns: `('l', 'i', 's', 't', 'i', 'n', 'g', 's')`)

```python
    def _get_raw_query(self, generator_asset):
        return self._store_backend.get(tuple(generator_asset))
```

I believe this should just be replaced with:

```python
    def _get_raw_query(self, generator_asset):
        return self._store_backend.get((generator_asset,))
```

Currently I can get around this by providing a tuple instead of a string, i.e.

```python
context.build_batch_kwargs(
    datasource='domi',
    generator='apartments-generator',
    name=('listings', )
)
```

But that goes against what the docs are saying [here](https://docs.greatexpectations.io/en/latest/module_docs/data_context_module.html#great_expectations.data_context.BaseDataContext.build_batch_kwargs):

![image](https://user-images.githubusercontent.com/11096727/79018985-30cd2f00-7b43-11ea-962c-3a563f19acc6.png)



Discussion:

Resolving patch:
diff --git a/great_expectations/datasource/generator/query_generator.py b/great_expectations/datasource/generator/query_generator.py
--- a/great_expectations/datasource/generator/query_generator.py
+++ b/great_expectations/datasource/generator/query_generator.py
@@ -25,7 +25,7 @@
 class QueryBatchKwargsGenerator(BatchKwargsGenerator):
     """Produce query-style batch_kwargs from sql files stored on disk
     """
-    recognized_batch_parameters = {'query_parameters', 'partition_id'}
+    recognized_batch_parameters = {'query_parameters', 'partition_id', 'name'}
 
     def __init__(self, name="default", datasource=None, query_store_backend=None, queries=None):
         super(QueryBatchKwargsGenerator, self).__init__(name=name, datasource=datasource)
@@ -66,7 +66,7 @@ def __init__(self, name="default", datasource=None, query_store_backend=None, qu
                 self.add_query(query_name, query)
 
     def _get_raw_query(self, generator_asset):
-        return self._store_backend.get(tuple(generator_asset))
+        return self._store_backend.get((generator_asset,))
 
     def _get_iterator(self, generator_asset, query_parameters=None):
         raw_query = self._get_raw_query(generator_asset)
@@ -91,7 +91,7 @@ def _get_iterator(self, generator_asset, query_parameters=None):
 
     def add_query(self, generator_asset, query):
         # Backends must have a tuple key; we use only a single-element tuple
-        self._store_backend.set(tuple(generator_asset), query)
+        self._store_backend.set((generator_asset,), query)
 
     def get_available_data_asset_names(self):
         defined_queries = self._store_backend.list_keys()


Test patch:
diff --git a/tests/datasource/generator/test_query_generator.py b/tests/datasource/generator/test_query_generator.py
--- a/tests/datasource/generator/test_query_generator.py
+++ b/tests/datasource/generator/test_query_generator.py
@@ -67,3 +67,30 @@ def test_get_available_data_asset_names_for_query_path(empty_data_context):
     generator = QueryBatchKwargsGenerator(name="mygenerator", datasource=data_source)
     sql_list = generator.get_available_data_asset_names()
     assert ("dummy", "query") in sql_list["names"]
+
+def test_build_batch_kwargs_for_query_path(basic_sqlalchemy_datasource, data_context):
+    base_directory = data_context.root_directory
+    basic_sqlalchemy_datasource._data_context = data_context
+    generator_name = 'my_generator'
+    query_str = "SELECT * FROM my_table"
+
+    default_sql_files_directory = os.path.join(
+        base_directory, 
+        'datasources', 
+        basic_sqlalchemy_datasource.name, 
+        'generators', 
+        generator_name, 
+    )
+    os.makedirs(default_sql_files_directory)
+    with open(os.path.join(default_sql_files_directory, "example.sql"), "w") as outfile:
+        outfile.write(query_str)
+
+    generator = QueryBatchKwargsGenerator(
+        name=generator_name, 
+        datasource=basic_sqlalchemy_datasource
+    )
+    batch_kwargs = generator.build_batch_kwargs(name='example')
+
+    assert isinstance(batch_kwargs, SqlAlchemyDatasourceQueryBatchKwargs)
+    assert batch_kwargs.query == query_str
+    assert batch_kwargs.query_parameters == None
\ No newline at end of file