Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Ensure maximum table name length #356

Merged
merged 7 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this provider will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### 💥 Breaking Changes
* Renamed columns of `aws_sagemaker_model_containers` image_config_repository_auth_config_repository_credentials_provider_arn -> image_config_repository_auth_config_repo_creds_provider_arn [#356](https://github.com/cloudquery/cq-provider-aws/pull/356).

## [v0.8.3] - 2021-12-15
###### SDK Version: 0.5.5

Expand Down
2 changes: 1 addition & 1 deletion docs/tables/aws_sagemaker_model_containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Describes the container, as part of model definition.
|environment|jsonb|The environment variables to set in the Docker container|
|image|text|The path where inference code is stored|
|image_config_repository_access_mode|text|Set this to one of the following values: * Platform - The model image is hosted in Amazon ECR. * Vpc - The model image is hosted in a private Docker registry in your VPC. This member is required.|
|image_config_repository_auth_config_repository_credentials_provider_arn|text|The Amazon Resource Name (ARN) of an Amazon Web Services Lambda function that provides credentials to authenticate to the private Docker registry where your model image is hosted|
|image_config_repository_auth_config_repo_creds_provider_arn|text|The Amazon Resource Name (ARN) of an Amazon Web Services Lambda function that provides credentials to authenticate to the private Docker registry where your model image is hosted|
|mode|text|Whether the container hosts a single model or multiple models.|
|model_data_url|text|The S3 path where the model artifacts, which result from model training, are stored|
|model_package_name|text|The name or Amazon Resource Name (ARN) of the model package to use to create the model.|
Expand Down
2 changes: 2 additions & 0 deletions resources/migrations/11_v0.8.4.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE IF EXISTS "aws_sagemaker_model_containers"
RENAME COLUMN "image_config_repository_auth_config_repo_creds_provider_arn" TO "image_config_repository_auth_config_repository_credentials_provider_arn";
2 changes: 2 additions & 0 deletions resources/migrations/11_v0.8.4.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE IF EXISTS "aws_sagemaker_model_containers"
RENAME COLUMN "image_config_repository_auth_config_repository_credentials_provider_arn" TO "image_config_repository_auth_config_repo_creds_provider_arn";
30 changes: 30 additions & 0 deletions resources/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
providertest "github.com/cloudquery/cq-provider-sdk/provider/testing"
"github.com/golang/mock/gomock"
"github.com/hashicorp/go-hclog"
"github.com/stretchr/testify/assert"
)

type TestOptions struct {
Expand Down Expand Up @@ -38,3 +39,32 @@ func awsTestHelper(t *testing.T, table *schema.Table, builder func(*testing.T, *
SkipEmptyJsonB: options.SkipEmptyJsonB,
})
}

func TestTableIdentifiers(t *testing.T) {
t.Parallel()
for _, res := range Provider().ResourceMap {
res := res
t.Run(res.Name, func(t *testing.T) {
testTableIdentifiers(t, res)
})
}
}

func testTableIdentifiers(t *testing.T, table *schema.Table) {
const maxIdentifierLength = 63 // maximum allowed identifier length is 63 bytes https://www.postgresql.org/docs/13/limits.html

assert.NotEmpty(t, table.Name)
assert.LessOrEqual(t, len(table.Name), maxIdentifierLength, "Table name too long")

for _, c := range table.Columns {
assert.NotEmpty(t, c.Name)
assert.LessOrEqual(t, len(c.Name), maxIdentifierLength, "Column name too long:", c.Name)
}

for _, res := range table.Relations {
res := res
t.Run(res.Name, func(t *testing.T) {
testTableIdentifiers(t, res)
})
}
}
2 changes: 1 addition & 1 deletion resources/sagemaker_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func SagemakerModels() *schema.Table {
Resolver: schema.PathResolver("ImageConfig.RepositoryAccessMode"),
},
{
Name: "image_config_repository_auth_config_repository_credentials_provider_arn",
Name: "image_config_repository_auth_config_repo_creds_provider_arn",
Description: "The Amazon Resource Name (ARN) of an Amazon Web Services Lambda function that provides credentials to authenticate to the private Docker registry where your model image is hosted",
Type: schema.TypeString,
Resolver: schema.PathResolver("ImageConfig.RepositoryAuthConfig.RepositoryCredentialsProviderArn"),
Expand Down