A command-line tool to export FalkorDB graph data to CSV files. This tool connects to a FalkorDB instance and exports both nodes and edges to separate CSV files for analysis, backup, or data migration purposes.
- Export graph nodes to CSV with properties and labels
- Export graph edges/relationships to CSV with properties and types
- Connect to local or remote FalkorDB instances
- Simple command-line interface
- Handles graph properties and metadata
- Python 3.8+
- pipenv (recommended) or pip
If you don't have pipenv installed:
pip install pipenvInstall and run:
# Clone the repository
git clone https://github.com/FalkorDB/graph-exporter.git
cd graph-exporter
# Install dependencies using pipenv
pipenv install
# Activate the virtual environment
pipenv shellExport a graph from a local FalkorDB instance:
python main.py <graph_name>Export from a remote FalkorDB instance:
python main.py <graph_name> --host <hostname> --port <port>usage: main.py [-h] [--host HOST] [--port PORT] graph_name
Export FalkorDB graph nodes and edges to CSV.
positional arguments:
graph_name Name of the graph to export
options:
-h, --help show this help message and exit
--host HOST FalkorDB host (default: localhost)
--port PORT FalkorDB port (default: 6379)
Export a graph named "social" from local FalkorDB:
python main.py socialExport from a remote FalkorDB instance:
python main.py social --host redis.example.com --port 6379The tool generates two CSV files:
Contains all nodes with the following columns:
id: Node IDlabel: Node label/type- Additional columns for each node property
Contains all relationships with the following columns:
id: Edge IDtype: Relationship typefrom_id: Source node IDto_id: Target node ID- Additional columns for each edge property
docker run --rm -p 6379:6379 falkordb/falkordbUse FalkorDB Cloud for a managed FalkorDB instance.
-
Start FalkorDB:
docker run --rm -p 6379:6379 falkordb/falkordb
-
Create some graph data using FalkorDB client or FalkorDB Browser
-
Export the graph:
# Using pipenv pipenv shell python main.py my_graph -
Find your exported data in
nodes.csvandedges.csv
# Install development dependencies (if any)
pipenv install --dev
# Add new dependencies
pipenv install <package_name>The project includes comprehensive tests that verify the export functionality with real FalkorDB instances.
-
Start a FalkorDB instance:
docker run --rm -p 6379:6379 falkordb/falkordb:latest
-
Install test dependencies:
pipenv install --dev
-
Run the tests:
pytest test_main.py -v
-
Run tests with coverage:
pytest --cov=main --cov-report=term-missing test_main.py
The project uses GitHub Actions for continuous integration:
- Tests are run against multiple Python versions (3.8-3.12)
- FalkorDB is started as a service container
- Coverage reports are uploaded to Codecov
- All tests must pass before merging PRs
- falkordb: Python client for FalkorDB
- pandas: Data manipulation and CSV export
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- π Documentation
- π¬ Community Forum
- π Report Issues
- π¬ Discord Community