diff --git a/README.md b/README.md index 7e34ee18f0..c0df940f3a 100644 --- a/README.md +++ b/README.md @@ -44,14 +44,19 @@ Apache Polaris is built using Gradle with Java 21+ and Docker 27+. - `./gradlew assemble` - To skip tests. - `./gradlew test` - To run unit tests and integration tests. - `./gradlew runApp` - To run the Polaris server locally on localhost:8181. - - The server starts with the in-memory mode, and it prints the auto-generated credentials to STDOUT in a message like this `realm: default-realm root principal credentials: :` - - These credentials can be used as "Client ID" and "Client Secret" in OAuth2 requests (e.g. the `curl` command below). -- `./regtests/run.sh` - To run regression tests or end-to-end tests in another terminal. +- `./regtests/run_spark_sql.sh` - To connect from Spark SQL. Here are some example commands to run in the Spark SQL shell: +```sql +create database db1; +show databases; +create table db1.table1 (id int, name string); +insert into db1.table1 values (1, 'a'); +select * from db1.table1; +``` +### More build and run options Running in Docker - `docker build -t localhost:5001/polaris:latest .` - To build the image. - `docker run -p 8181:8181 localhost:5001/polaris:latest` - To run the image in standalone mode. -- `docker compose up --build --exit-code-from regtest` - To run regression tests in a Docker environment. Running in Kubernetes - `./run.sh` - To run Polaris as a mini-deployment locally. This will create one pod that bind itself to ports `8181` and `8182`. @@ -63,6 +68,10 @@ Running in Kubernetes - `kubectl get deployment -n polaris` - To check the status of the deployment. - `kubectl describe deployment polaris-deployment -n polaris` - To troubleshoot if things aren't working as expected. +Running regression tests +- `./regtests/run.sh` - To run regression tests in another terminal. +- `docker compose up --build --exit-code-from regtest` - To run regression tests in a Docker environment. + Building docs - Docs are generated using [Redocly](https://redocly.com/docs/cli/installation). To regenerate them, run the following commands from the project root directory. @@ -71,24 +80,6 @@ docker run -p 8080:80 -v ${PWD}:/spec docker.io/redocly/cli join spec/docs.yaml docker run -p 8080:80 -v ${PWD}:/spec docker.io/redocly/cli build-docs spec/index.yaml --output=docs/index.html --config=spec/redocly.yaml ``` -## Connecting from an Engine -To connect from an engine like Spark, first create a catalog with these steps: -```bash -# Generate a token for the root principal, replacing and with -# the values from the Polaris server output. -export PRINCIPAL_TOKEN=$(curl -X POST http://localhost:8181/api/catalog/v1/oauth/tokens \ - -d 'grant_type=client_credentials&client_id=&client_secret=&scope=PRINCIPAL_ROLE:ALL' \ - | jq -r '.access_token') - -# Create a catalog named `polaris` -curl -i -X POST -H "Authorization: Bearer $PRINCIPAL_TOKEN" -H 'Accept: application/json' -H 'Content-Type: application/json' \ - http://localhost:8181/api/management/v1/catalogs \ - -d '{"name": "polaris", "id": 100, "type": "INTERNAL", "readOnly": false, "storageConfigInfo": {"storageType": "FILE"}, "properties": {"default-base-location": "file:///tmp/polaris"}}' -``` - -From here, you can use Spark to create namespaces, tables, etc. More details can be found in the -[Quick Start Guide](https://polaris.apache.org/#section/Quick-Start/Using-Iceberg-and-Polaris). - ## License Apache Polaris is under the Apache License Version 2.0. See the [LICENSE](LICENSE).