/minerva

Primary LanguageRust

Minerva

Minerva is a Amazon Athena mock server.

Usage

  • create fixture csv file (Minerva treats csv file name as table name)
> echo 'id,name
1,zaneli
2,athena
3,minerva' > users.csv
  • start minerva server
> cargo run
  • Run Athena CLI or other SDK
> aws --endpoint-url="http://localhost:5050" athena start-query-execution --query-string="SELECT * FROM users;"
{
    "QueryExecutionId": "3b773ac8-6a53-49e4-83d9-2cbf2ce51fa5"
}

> aws --endpoint-url="http://localhost:5050" athena get-query-execution --query-execution-id="3b773ac8-6a53-49e4-83d9-2cbf2ce51fa5"
{
    "QueryExecution": {
        "QueryExecutionId": "3b773ac8-6a53-49e4-83d9-2cbf2ce51fa5",
        "Status": {
            "State": "SUCCEEDED"
        }
    }
}

> aws --endpoint-url="http://localhost:5050" athena get-query-results --query-execution-id="3b773ac8-6a53-49e4-83d9-2cbf2ce51fa5"
{
    "ResultSet": {
        "Rows": [
            {
                "Data": [
                    {
                        "VarCharValue": "id"
                    },
                    {
                        "VarCharValue": "name"
                    }
                ]
            },
            {
                "Data": [
                    {
                        "VarCharValue": "1"
                    },
                    {
                        "VarCharValue": "zaneli"
                    }
                ]
            },
            {
                "Data": [
                    {
                        "VarCharValue": "2"
                    },
                    {
                        "VarCharValue": "athena"
                    }
                ]
            },
            {
                "Data": [
                    {
                        "VarCharValue": "3"
                    },
                    {
                        "VarCharValue": "minerva"
                    }
                ]
            }
        ],
        "ResultSetMetadata": {
            "ColumnInfo": [
                {
                    "TableName": "users",
                    "Name": "id",
                    "Label": "id"
                },
                {
                    "TableName": "users",
                    "Name": "name",
                    "Label": "name"
                }
            ]
        }
    },
    "UpdateCount": 0
}

> aws --endpoint-url="http://localhost:5050" athena get-query-results --query-execution-id="3b773ac8-6a53-49e4-83d9-2cbf2ce51fa5" --max-results=2
{
    "UpdateCount": 0,
    "ResultSet": {
        "Rows": [
            {
                "Data": [
                    {
                        "VarCharValue": "id"
                    },
                    {
                        "VarCharValue": "name"
                    }
                ]
            },
            {
                "Data": [
                    {
                        "VarCharValue": "1"
                    },
                    {
                        "VarCharValue": "zaneli"
                    }
                ]
            }
        ],
        "ResultSetMetadata": {
            "ColumnInfo": [
                {
                    "TableName": "users",
                    "Name": "id",
                    "Label": "id"
                },
                {
                    "TableName": "users",
                    "Name": "name",
                    "Label": "name"
                }
            ]
        }
    },
    "NextToken": "2"
}

Support API