Skip to content

Add BOOLEAN option for schema column type #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ The accepted data types are:
| IGNORE | This column will not be added to the graph | Optional |
| DOUBLE / FLOAT | A signed 64-bit floating-point value | Yes |
| INT / INTEGER / LONG | A signed 64-bit integer value | Yes |
| BOOL | A boolean value indicated by the string 'true' or 'false' | Yes |
| BOOL / BOOLEAN | A boolean value indicated by the string 'true' or 'false' | Yes |
| STRING | A string value | Yes |
| ARRAY | An array value | Yes |

Expand Down
1 change: 1 addition & 0 deletions redisgraph_bulk_loader/entity_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class Type(Enum):
UNKNOWN = 0
BOOL = 1
BOOLEAN = 1 # alias to BOOL
DOUBLE = 2
FLOAT = 2 # alias to DOUBLE
STRING = 3
Expand Down
12 changes: 6 additions & 6 deletions test/test_bulk_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ def test09_schema(self):
graphname = "tmpgraph7"
with open('/tmp/nodes.tmp', mode='w') as csv_file:
out = csv.writer(csv_file)
out.writerow(['str_col:STRING', 'num_col:INT'])
out.writerow([0, 0])
out.writerow([1, 1])
out.writerow(['str_col:STRING', 'num_col:INT', 'bool_col:BOOLEAN'])
out.writerow([0, 0, True])
out.writerow([1, 1, False])

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

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

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