'test to ensure that materialized view metadata is properly constructed when quoted identifiers are used
test_metadata_with_quoted_identifiers tests that materialized views metadata is properly constructed.
It runs a simple query to construct a materialized view, then proceeds to inspect the metadata associated with
that MV. The caveat here is that the tables and the materialized view both have quoted identifiers
Columns are inspected to insure that all are of the proper type, and in the proper type.
@since 3.0.0
@jira_ticket PYTHON-371
@expected_result Materialized view metadata should be constructed appropriately even with quoted identifiers.
@test_category metadata'

def test_metadata_with_quoted_identifiers(self):

    create_table = 'CREATE    TABLE    {0}.t1    (\n                                                                                                "theKey"    int,\n                                                                                                "the;Clustering"    int,\n                                                                                                "the    Value"    int,\n                                                                                                PRIMARY    KEY    ("theKey",    "the;Clustering"))'.format(self.keyspace_name)
    self.session.execute(create_table)
    create_mv = 'CREATE    MATERIALIZED    VIEW    {0}.mv1    AS\n                                                                                SELECT    "theKey",    "the;Clustering",    "the    Value"\n                                                                                FROM    {0}.t1\n                                                                                WHERE    "theKey"    IS    NOT    NULL    AND    "the;Clustering"    IS    NOT    NULL    AND    "the    Value"    IS    NOT    NULL\n                                                                                PRIMARY    KEY    ("theKey",    "the;Clustering")'.format(self.keyspace_name)
    self.session.execute(create_mv)
    t1_table = self.cluster.metadata.keyspaces[self.keyspace_name].tables['t1']
    mv = self.cluster.metadata.keyspaces[self.keyspace_name].views['mv1']
    self.assertIsNotNone(t1_table.views['mv1'])
    self.assertIsNotNone(len(t1_table.views), 1)
    self.assertEqual(len(t1_table.partition_key), 1)
    self.assertIsNotNone(t1_table.columns['theKey'])
    self.assertTrue(t1_table.columns['theKey'], t1_table.partition_key[0])
    self.assertEqual(len(t1_table.clustering_key), 1)
    self.assertIsNotNone(t1_table.columns['the;Clustering'])
    self.assertTrue(t1_table.columns['the;Clustering'], t1_table.clustering_key[0])
    self.assertIsNotNone(t1_table.columns['the    Value'])
    self.assertEqual(mv.keyspace_name, self.keyspace_name)
    self.assertEqual(mv.name, 'mv1')
    self.assertEqual(mv.base_table_name, 't1')
    self.assertFalse(mv.include_all_columns)
    mv_columns = list(mv.columns.values())
    self.assertEqual(len(mv_columns), 3)
    theKey_column = mv_columns[0]
    self.assertIsNotNone(theKey_column)
    self.assertEqual(theKey_column.name, 'theKey')
    self.assertEqual(theKey_column, mv.partition_key[0])
    cluster_column = mv_columns[1]
    self.assertIsNotNone(cluster_column)
    self.assertEqual(cluster_column.name, 'the;Clustering')
    self.assertEqual(cluster_column.name, mv.clustering_key[0].name)
    self.assertEqual(cluster_column.table, mv.clustering_key[0].table)
    self.assertEqual(cluster_column.is_static, mv.clustering_key[0].is_static)
    self.assertEqual(cluster_column.is_reversed, mv.clustering_key[0].is_reversed)
    value_column = mv_columns[2]
    self.assertIsNotNone(value_column)
    self.assertEqual(value_column.name, 'the    Value')
