From b87e390204125b47191a58df4a23261e861178c5 Mon Sep 17 00:00:00 2001 From: Junda Yang Date: Thu, 25 Apr 2019 14:37:40 -0700 Subject: [PATCH] unquote boolean value is_view when publish to neo4j (#28) * unquote bool value is_view when publish to neo4j * fix test --- databuilder/models/table_metadata.py | 3 ++- setup.py | 2 +- tests/unit/models/test_table_metadata.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/databuilder/models/table_metadata.py b/databuilder/models/table_metadata.py index c9f35b1d7..46eb7427d 100644 --- a/databuilder/models/table_metadata.py +++ b/databuilder/models/table_metadata.py @@ -5,6 +5,7 @@ from databuilder.models.neo4j_csv_serde import ( Neo4jCsvSerializable, NODE_LABEL, NODE_KEY, RELATION_START_KEY, RELATION_END_KEY, RELATION_START_LABEL, RELATION_END_LABEL, RELATION_TYPE, RELATION_REVERSE_TYPE) +from databuilder.publisher.neo4j_csv_publisher import UNQUOTED_SUFFIX DESCRIPTION_NODE_LABEL = 'Description' @@ -68,7 +69,7 @@ class TableMetadata(Neo4jCsvSerializable): TABLE_NODE_LABEL = 'Table' TABLE_KEY_FORMAT = '{db}://{cluster}.{schema}/{tbl}' TABLE_NAME = 'name' - IS_VIEW = 'is_view' + IS_VIEW = 'is_view{}'.format(UNQUOTED_SUFFIX) # bool value needs to be unquoted when publish to neo4j TABLE_DESCRIPTION = 'description' TABLE_DESCRIPTION_FORMAT = '{db}://{cluster}.{schema}/{tbl}/_description' diff --git a/setup.py b/setup.py index 2e2ef3718..8f9a7a6aa 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages -__version__ = '1.0.10' +__version__ = '1.0.11' setup( diff --git a/tests/unit/models/test_table_metadata.py b/tests/unit/models/test_table_metadata.py index d2fdee0d2..1acdb555e 100644 --- a/tests/unit/models/test_table_metadata.py +++ b/tests/unit/models/test_table_metadata.py @@ -24,7 +24,8 @@ def setUp(self): ColumnMetadata('ds', None, 'varchar', 5)]) self.expected_nodes_deduped = [ - {'name': 'test_table1', 'KEY': 'hive://gold.test_schema1/test_table1', 'LABEL': 'Table', 'is_view': False}, + {'name': 'test_table1', 'KEY': 'hive://gold.test_schema1/test_table1', 'LABEL': 'Table', + 'is_view:UNQUOTED': False}, {'description': 'test_table1', 'KEY': 'hive://gold.test_schema1/test_table1/_description', 'LABEL': 'Description'}, {'sort_order': 0, 'type': 'bigint', 'name': 'test_id1',