Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/content/spark/sql-ddl.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,50 @@ spark-sql ... \

```

```sql
USE paimon.default;
```
#### Creating REST Catalog

By using the Paimon REST catalog, changes to the catalog will be directly stored in remote server.

##### bear token
```bash
spark-sql ... \
--conf spark.sql.catalog.paimon=org.apache.paimon.spark.SparkCatalog \
--conf spark.sql.catalog.paimon.metastore=rest \
--conf spark.sql.catalog.paimon.uri=<catalog server url> \
--conf spark.sql.catalog.paimon.token.provider=bear \
--conf spark.sql.catalog.paimon.token=<token>

```

##### dlf ak
```bash
spark-sql ... \
--conf spark.sql.catalog.paimon=org.apache.paimon.spark.SparkCatalog \
--conf spark.sql.catalog.paimon.metastore=rest \
--conf spark.sql.catalog.paimon.uri=<catalog server url> \
--conf spark.sql.catalog.paimon.token.provider=dlf \
--conf spark.sql.catalog.paimon.dlf.accessKeyId=<accessKeyId> \
--conf spark.sql.catalog.paimon.dlf.accessKeySecret=<accessKeySecret>

```

##### dlf sts token
```bash
spark-sql ... \
--conf spark.sql.catalog.paimon=org.apache.paimon.spark.SparkCatalog \
--conf spark.sql.catalog.paimon.metastore=rest \
--conf spark.sql.catalog.paimon.uri=<catalog server url> \
--conf spark.sql.catalog.paimon.token.provider=dlf \
--conf spark.sql.catalog.paimon.dlf.accessKeyId=<accessKeyId> \
--conf spark.sql.catalog.paimon.dlf.accessKeySecret=<accessKeySecret> \
--conf spark.sql.catalog.paimon.dlf.securityToken=<securityToken>


```

```sql
USE paimon.default;
```
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.paimon.rest;

import org.testcontainers.shaded.com.google.common.collect.ImmutableMap;

import java.util.Map;

/** Refresh data token in test mode. */
public class DataTokenProvider {

private Map<String, String> token;
private long expiresAtMillis;

public DataTokenProvider(Map<String, String> token, long expiresAtMillis) {
this.token = token;
this.expiresAtMillis = expiresAtMillis;
}

public void setExpiresAtMillis(long expiresAtMillis) {
this.expiresAtMillis = expiresAtMillis;
}

public Map<String, String> getToken() {
return token;
}

public long getExpiresAtMillis() {
return expiresAtMillis;
}

public void setToken(Map<String, String> token) {
this.token = token;
}

public void refresh() {
this.token =
ImmutableMap.of(
"ak",
"ak-" + System.currentTimeMillis(),
"sk",
"sk-" + System.currentTimeMillis());
this.expiresAtMillis = System.currentTimeMillis();
}
}
Loading
Loading