Spaces:
Runtime error
Runtime error
A newer version of the Gradio SDK is available:
6.5.1
Lineagentic-flow CLI
A command-line interface for the Lineagentic-flow framework that provides agentic data lineage parsing across various data processing script types.
Installation
The CLI is automatically installed when you install the lineagentic-flow package:
pip install -e .
Usage
The CLI provides two main commands: analyze and field-lineage.
Basic Commands
Analyze Query/Code for Lineage
lineagentic analyze --agent-name sql-lineage-agent --query "your code here"
Running Analysis
Using a Specific Agent
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT a,b FROM table1"
Using a File as Input
lineagentic analyze --agent-name python-lineage-agent --query-file path/to/your/script.py
Specifying a Different Model
lineagentic analyze --agent-name airflow-lineage-agent --model-name gpt-4o --query "your code here"
With Lineage Configuration
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT * FROM users" --job-namespace "my-namespace" --job-name "my-job"
Output Options
Pretty Print Results
lineagentic analyze --agent-name sql --query "your code" --pretty
Save Results to File
lineagentic analyze --agent-name sql --query "your code" --output results.json
Save Results with Pretty Formatting
lineagentic analyze --agent-name python --query "your code" --output results.json --pretty
Enable Verbose Output
lineagentic analyze --agent-name sql --query "your code" --verbose
Available Agents
- sql-lineage-agent: Analyzes SQL queries and scripts (default)
- airflow-lineage-agent: Analyzes Apache Airflow DAGs and workflows
- spark-lineage-agent: Analyzes Apache Spark jobs
- python-lineage-agent: Analyzes Python data processing scripts
- java-lineage-agent: Analyzes Java data processing code
Commands
analyze Command
Analyzes a query or code for lineage information.
Required Arguments
- Either
--queryor--query-filemust be specified
Basic Query Analysis
# Simple SQL query analysis
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT user_id, name FROM users WHERE active = true"
# Analyze with specific agent
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT a, b FROM table1 JOIN table2 ON table1.id = table2.id"
# Analyze Python code
lineagentic analyze --agent-name python-lineage-agent --query "import pandas as pd; df = pd.read_csv('data.csv'); result = df.groupby('category').sum()"
# Analyze Java code
lineagentic analyze --agent-name java-lineage-agent --query "public class DataProcessor { public void processData() { // processing logic } }"
# Analyze Spark code
lineagentic analyze --agent-name spark-lineage-agent --query "val df = spark.read.csv('data.csv'); val result = df.groupBy('category').agg(sum('value'))"
# Analyze Airflow DAG
lineagentic analyze --agent-name airflow-lineage-agent --query "from airflow import DAG; from airflow.operators.python import PythonOperator; dag = DAG('my_dag')"
Reading from File
# Analyze query from file
lineagentic analyze --agent-name sql-lineage-agent --query-file "queries/user_analysis.sql"
# Analyze Python script from file
lineagentic analyze --agent-name python-lineage-agent --query-file "scripts/data_processing.py"
Output Options
# Save results to file
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT * FROM users" --output "results.json"
# Pretty print results
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT * FROM users" --pretty
# Verbose output
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT * FROM users" --verbose
# Don't save to database
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT * FROM users" --no-save
# Don't save to Neo4j
lineagentic analyze --agent-name sql-lineage-agent --query "SELECT * FROM users" --no-neo4j
Common Output Options
Both commands support these output options:
--output: Output file path for results (JSON format)--pretty: Pretty print the output--verbose: Enable verbose output
Error Handling
The CLI provides clear error messages for common issues:
- Missing required arguments
- File not found errors
- Agent execution errors
- Invalid agent names
Development
To run the CLI in development mode:
python -m cli.main --help
To run a specific command:
python -m cli.main analyze --agent-name sql --query "SELECT 1" --pretty