Skip to content

Commit 2108e7e

Browse files
Add BOOLEAN option for schema column type (#73)
1 parent d4e83e7 commit 2108e7e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ The accepted data types are:
146146
| IGNORE | This column will not be added to the graph | Optional |
147147
| DOUBLE / FLOAT | A signed 64-bit floating-point value | Yes |
148148
| INT / INTEGER / LONG | A signed 64-bit integer value | Yes |
149-
| BOOL | A boolean value indicated by the string 'true' or 'false' | Yes |
149+
| BOOL / BOOLEAN | A boolean value indicated by the string 'true' or 'false' | Yes |
150150
| STRING | A string value | Yes |
151151
| ARRAY | An array value | Yes |
152152

redisgraph_bulk_loader/entity_file.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
class Type(Enum):
1515
UNKNOWN = 0
1616
BOOL = 1
17+
BOOLEAN = 1 # alias to BOOL
1718
DOUBLE = 2
1819
FLOAT = 2 # alias to DOUBLE
1920
STRING = 3

test/test_bulk_loader.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ def test09_schema(self):
453453
graphname = "tmpgraph7"
454454
with open('/tmp/nodes.tmp', mode='w') as csv_file:
455455
out = csv.writer(csv_file)
456-
out.writerow(['str_col:STRING', 'num_col:INT'])
457-
out.writerow([0, 0])
458-
out.writerow([1, 1])
456+
out.writerow(['str_col:STRING', 'num_col:INT', 'bool_col:BOOLEAN'])
457+
out.writerow([0, 0, True])
458+
out.writerow([1, 1, False])
459459

460460
runner = CliRunner()
461461
res = runner.invoke(bulk_insert, ['--nodes', '/tmp/nodes.tmp',
@@ -466,9 +466,9 @@ def test09_schema(self):
466466
self.assertIn('2 nodes created', res.output)
467467

468468
graph = Graph(graphname, self.redis_con)
469-
query_result = graph.query('MATCH (a) RETURN a.str_col, a.num_col ORDER BY a.num_col')
470-
expected_result = [['0', 0],
471-
['1', 1]]
469+
query_result = graph.query('MATCH (a) RETURN a.str_col, a.num_col, a.bool_col ORDER BY a.num_col')
470+
expected_result = [['0', 0, True],
471+
['1', 1, False]]
472472

473473
# The graph should have the correct types for all properties
474474
self.assertEqual(query_result.result_set, expected_result)

0 commit comments

Comments
 (0)