Skip to content

Commit

Permalink
Refactor TableService configuration to match the common style used by…
Browse files Browse the repository at this point in the history
… other services. (unitycatalog#258)

**PR Checklist**

- [X] A description of the changes is added to the description of this
PR.
- [X] If there is a related issue, make sure it is linked to this PR.
- [X] If you've fixed a bug or added code that should be tested, add
tests!
- [ ] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

This is a minor refactor to make TableService configuration match that
of other services.
Related Issue unitycatalog#257
  • Loading branch information
creechy authored Jul 19, 2024
1 parent bb8dd4f commit 2e6962e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void addServices(ServerBuilder sb) {
.annotatedService(basePath + "catalogs", catalogService, unityConverterFunction)
.annotatedService(basePath + "schemas", schemaService, unityConverterFunction)
.annotatedService(basePath + "volumes", volumeService, unityConverterFunction)
.annotatedService(basePath, tableService, unityConverterFunction)
.annotatedService(basePath + "tables", tableService, unityConverterFunction)
.annotatedService(basePath + "functions", functionService, unityConverterFunction)
.annotatedService(
basePath + "temporary-table-credentials", temporaryTableCredentialsService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ public class TableService {

public TableService() {}

@Post("/tables")
@Post("")
public HttpResponse createTable(CreateTable createTable) {
assert createTable != null;
TableInfo createTableResponse = TABLE_REPOSITORY.createTable(createTable);
return HttpResponse.ofJson(createTableResponse);
}

@Get("/tables/{full_name}")
@Get("/{full_name}")
public HttpResponse getTable(@Param("full_name") String fullName) {
assert fullName != null;
TableInfo tableInfo = TABLE_REPOSITORY.getTable(fullName);
return HttpResponse.ofJson(tableInfo);
}

@Get("/tables")
@Get("")
public HttpResponse listTables(
@Param("catalog_name") String catalogName,
@Param("schema_name") String schemaName,
Expand All @@ -48,7 +48,7 @@ public HttpResponse listTables(
omitColumns.orElse(false)));
}

@Delete("/tables/{full_name}")
@Delete("/{full_name}")
public HttpResponse deleteTable(@Param("full_name") String fullName) {
TABLE_REPOSITORY.deleteTable(fullName);
return HttpResponse.of(HttpStatus.OK);
Expand Down

0 comments on commit 2e6962e

Please sign in to comment.