The GraphAr Python package installs a graphar command-line tool for inspecting
GraphAr metadata and importing data into GraphAr format.
The CLI is implemented with Typer and uses the same Python bindings as the
graphar Python package.
- Python >= 3.9
- pip
- CMake >= 3.15, Apache Arrow >= 12.0, and a C++ toolchain when building from source
Install the latest released version from PyPI:
pip install -U grapharOr install from the repository root:
pip install ./pythonVerify the CLI is available:
graphar --helpReplace the paths below with paths to your GraphAr metadata or import config files.
# Show all graph metadata.
graphar show --path path/to/graph.graph.yml
# Validate graph metadata.
graphar check --path path/to/graph.graph.yml
# Show one vertex type.
graphar show --path path/to/graph.graph.yml --vertex Person
# Show one edge type.
graphar show \
--path path/to/graph.graph.yml \
--edge-src Person \
--edge ACTED_IN \
--edge-dst Movie
# Import data with a config file.
graphar import --config path/to/import.ymlShort options are also available:
graphar show -p path/to/graph.graph.yml -v Person
graphar show -p path/to/graph.graph.yml -es Person -e ACTED_IN -ed Movie
graphar import -c path/to/import.ymlThe import command reads a YAML config file. A config describes source files, GraphAr output settings, and how source columns map to vertex or edge properties.
Supported source file types are csv, json, parquet, and orc. JSON input
uses JSON Lines format and should use the .json extension. You can override
extension-based detection by setting file_type in the source config.
Important fields:
sourcesdescribes the input files. CSV sources can set adelimiter.columnsmaps source column names to GraphAr property names.- Edge property names must not duplicate endpoint property names.
- Empty fields in
import_schemause values from the top-levelgrapharconfig. Explicitimport_schemavalues override the top-level defaults.
Common defaults:
| Field | Default value |
|---|---|
graphar.vertex_chunk_size |
100 |
graphar.edge_chunk_size |
1024 |
graphar.file_type |
parquet |
graphar.adj_list_type |
ordered_by_source |
graphar.validate_level |
weak |
graphar.version |
gar/v1 |
property.nullable |
true |