Skip to content

Commit 60548b2

Browse files
committed
First Version of LOAD CSV
1 parent e33c44b commit 60548b2

File tree

5 files changed

+334
-513
lines changed

5 files changed

+334
-513
lines changed

regress/sql/csv_load.sql

Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,68 @@
1-
2-
\! cp regress/test.csv regress/instance/data/
3-
4-
LOAD 'postgraph';
5-
6-
CREATE GRAPH cypher_create;
7-
USE GRAPH cypher_create;
8-
9-
CYPHER LOAD CSV './test.csv' AS n
10-
RETURN n;
11-
12-
--
13-
-- Clean up
14-
--
15-
DROP GRAPH cypher_create CASCADE;
16-
17-
--
18-
-- End
19-
--
1+
/*
2+
* Copyright (C) 2025 PostGraphDB
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
\! cp -r regress/load/data regress/instance/data/load
19+
20+
LOAD 'postgraph';
21+
22+
CREATE GRAPH load_csv;
23+
USE GRAPH load_csv;
24+
25+
CYPHER LOAD CSV 'load/test.csv' AS n
26+
RETURN n;
27+
28+
CYPHER LOAD CSV 'load/test.csv' AS n
29+
RETURN n[0];
30+
31+
CYPHER WITH '["booker12", "9012", "Rachel", "Booker"]' AS n
32+
RETURN n[2];
33+
34+
CYPHER LOAD CSV 'load/test.csv' AS n;
35+
36+
CYPHER LOAD CSV 'load/test.csv' AS n
37+
CREATE (a:Person {name: n});
38+
39+
MATCH (a:Person) RETURN a;
40+
41+
MATCH (a:Person)
42+
LOAD CSV 'load/test.csv' AS n
43+
CREATE (a)-[:elabel]->(b:Person {name: n})
44+
RETURN a, b;
45+
46+
47+
48+
/* Crashes
49+
MATCH (a:Person)
50+
LOAD CSV 'load/test.csv' AS n
51+
MERGE (b:Person {name: n})
52+
CREATE (a)-[:elabel2]->(b);
53+
54+
55+
MATCH (a:Person)
56+
LOAD CSV 'load/test.csv' AS n
57+
MERGE (b:Person {name: n})
58+
CREATE (a)-[:elabel2]->(b)
59+
RETURN a, b;*/
60+
61+
--
62+
-- Clean up
63+
--
64+
DROP GRAPH load_csv CASCADE;
65+
66+
--
67+
-- End
68+
--

0 commit comments

Comments
 (0)