Skip to content

Commit d1add18

Browse files
authored
feat(aws)!: Define composite primary key for lambda_function_versions (#12402)
#### Summary This PR is aimed to address #12391 by creating a composite primary key on `aws_lambda_function_versions` table comprising `function_arn` and `version`. Since `function_arn` will always be unique, `account_id` or `region` are not required to be part of the primary key. #### Summary This is my first PR against the codebase, extra pair of eyes are highly recommended!
1 parent f7a94ca commit d1add18

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

plugins/source/aws/resources/services/lambda/function_versions.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ func functionVersions() *schema.Table {
1717
Name: tableName,
1818
Description: `https://docs.aws.amazon.com/lambda/latest/dg/API_FunctionConfiguration.html`,
1919
Resolver: fetchLambdaFunctionVersions,
20-
Transform: transformers.TransformWithStruct(&types.FunctionConfiguration{}),
20+
Transform: transformers.TransformWithStruct(&types.FunctionConfiguration{}, transformers.WithPrimaryKeys("Version")),
2121
Columns: []schema.Column{
2222
client.DefaultAccountIDColumn(false),
2323
client.DefaultRegionColumn(false),
2424
{
25-
Name: "function_arn",
26-
Type: arrow.BinaryTypes.String,
27-
Resolver: schema.ParentColumnResolver("arn"),
25+
Name: "function_arn",
26+
Type: arrow.BinaryTypes.String,
27+
Resolver: schema.ParentColumnResolver("arn"),
28+
PrimaryKey: true,
2829
},
2930
},
3031
}

website/tables/aws/aws_lambda_function_versions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This table shows data for AWS Lambda Function Versions.
44

55
https://docs.aws.amazon.com/lambda/latest/dg/API_FunctionConfiguration.html
66

7-
The primary key for this table is **_cq_id**.
7+
The composite primary key for this table is (**function_arn**, **version**).
88

99
## Relations
1010

@@ -14,11 +14,11 @@ This table depends on [aws_lambda_functions](aws_lambda_functions).
1414

1515
| Name | Type |
1616
| ------------- | ------------- |
17-
|_cq_id (PK)|`uuid`|
17+
|_cq_id|`uuid`|
1818
|_cq_parent_id|`uuid`|
1919
|account_id|`utf8`|
2020
|region|`utf8`|
21-
|function_arn|`utf8`|
21+
|function_arn (PK)|`utf8`|
2222
|architectures|`list<item: utf8, nullable>`|
2323
|code_sha256|`utf8`|
2424
|code_size|`int64`|
@@ -51,5 +51,5 @@ This table depends on [aws_lambda_functions](aws_lambda_functions).
5151
|state_reason_code|`utf8`|
5252
|timeout|`int64`|
5353
|tracing_config|`json`|
54-
|version|`utf8`|
54+
|version (PK)|`utf8`|
5555
|vpc_config|`json`|

0 commit comments

Comments
 (0)