You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the `migrate.duckdb()` procedure, users can connect to the ** DuckDB** database and query various data sources.
101
+
List of data sources that are supported by DuckDB can be found on their [official documentation page](https://duckdb.org/docs/stable/data/data_sources.html).
102
+
The underlying implementation streams results from DuckDB to Memgraph using the `duckdb` Python Library. DuckDB is started with the in-memory mode, without any
103
+
persistence and is used just to proxy to the underlying data sources.
104
+
105
+
{<h4className="custom-header"> Input: </h4>}
106
+
107
+
-`query: str` ➡ Table name or an SQL query.
108
+
-`setup_queries: mgp.Nullable[List[str]]` ➡ List of queries that will be executed prior to the query provided as the initial argument.
109
+
Used for setting up the connection to additional data sources.
110
+
111
+
{<h4className="custom-header"> Output: </h4>}
112
+
113
+
-`row: mgp.Map` ➡ The result table as a stream of rows.
114
+
115
+
{<h4className="custom-header"> Usage: </h4>}
116
+
117
+
#### Retrieve and inspect data
118
+
```cypher
119
+
CALL migrate.duckdb("SELECT * FROM 'test.parquet';")
120
+
YIELD row
121
+
RETURN row
122
+
LIMIT 5000;
123
+
```
124
+
125
+
#### Filter specific data
126
+
```cypher
127
+
CALL migrate.duckdb("SELECT * FROM 'test.parquet';")
128
+
YIELD row
129
+
WHERE row.age >= 30
130
+
RETURN row;
131
+
```
132
+
133
+
#### Create nodes from migrated data
134
+
```cypher
135
+
CALL migrate.duckdb("SELECT * FROM 'test.parquet';")
CALL migrate.duckdb("SELECT * FROM 'test.parquet';")
143
+
YIELD row
144
+
MATCH (u1:User {id: row.user1_id}), (u2:User {id: row.user2_id})
145
+
CREATE (u1)-[:FRIENDS_WITH]->(u2);
146
+
```
147
+
148
+
#### Setup connection to query additional data sources
149
+
```cypher
150
+
CALL migrate.duckdb("SELECT * FROM 's3://your_bucket/your_file.parquet';", ["CREATE SECRET secret1 (TYPE s3, KEY_ID 'key', SECRET 'secret', REGION 'region');"])
151
+
YIELD row
152
+
MATCH (u1:User {id: row.user1_id}), (u2:User {id: row.user2_id})
153
+
CREATE (u1)-[:FRIENDS_WITH]->(u2);
154
+
```
155
+
156
+
---
157
+
158
+
### `memgraph()`
159
+
160
+
With the `migrate.memgraph()` procedure, you can access another Memgraph instance and migrate your data to a new Memgraph instance.
161
+
The resulting nodes and edges are converted into a stream of rows which can include labels, properties, and primitives.
162
+
163
+
<Callouttype="info">
164
+
Streaming of raw node and relationship objects is not supported and users are advised to migrate all the necessary identifiers in order to recreate the same graph in Memgraph.
165
+
</Callout>
166
+
167
+
{<h4className="custom-header"> Input: </h4>}
168
+
169
+
-`label_or_rel_or_query: str` ➡ Label name (written in format `(:Label)`), relationship name (written in format `[:rel_type]`) or a plain cypher query.
170
+
-`config: mgp.Map` ➡ Connection parameters (as in `gqlalchemy.Memgraph`). Notable parameters are `host[String]`, and `port[Integer]`
171
+
-`config_path` ➡ Path to a JSON file containing configuration parameters.
-`row: mgp.Map` ➡ The result table as a stream of rows.
177
+
- when retrieving nodes using the `(:Label)` syntax, row will have the following keys: `labels`, and `properties`
178
+
- when retrieving relationships using the `[:REL_TYPE]` syntax, row will have the following keys: `from_labels`, `to_labels`, `from_properties`, `to_properties`, and `edge_properties`
179
+
- when retrieving results using a plain Cypher query, row will have keys identical to the returned column names from the Cypher query
180
+
181
+
{<h4className="custom-header"> Usage: </h4>}
182
+
183
+
#### Retrieve nodes of certain label and create them in a new Memgraph instance
With the `migrate.servicenow()` procedure, you can access [ServiceNow REST API](https://developer.servicenow.com/dev.do#!/reference/api/xanadu/rest/) and transfer your data to Memgraph.
520
+
The underlying implementation is using the [`requests` Python library] to migrate results to Memgraph. The REST API from
521
+
ServiceNow must provide results in the format `{results: []}` in order for Memgraph to stream it into result rows.
522
+
523
+
{<h4className="custom-header"> Input: </h4>}
524
+
525
+
-`endpoint: str` ➡ ServiceNow endpoint. Users can optionally include their own query parameters to filter results.
526
+
-`config: mgp.Map` ➡ Connection parameters. Notable connection parameters are `username` and `password`, per `requests.get()` method.
527
+
-`config_path: str` ➡ Path to a JSON file containing configuration parameters.
528
+
529
+
{<h4className="custom-header"> Output: </h4>}
530
+
531
+
-`row: mgp.Map` ➡ Each row from the CSV file as a structured dictionary.
532
+
533
+
{<h4className="custom-header"> Usage: </h4>}
534
+
535
+
#### Retrieve and inspect CSV data from ServiceNow
0 commit comments