Skip to content

Commit

Permalink
Remove manual refresh for S3 integrations (opensearch-project#1226)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiddis authored Nov 2, 2023
1 parent ae76f36 commit 80f112a
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,13 @@ export function SetupBottomBar({
'{table_name}',
`${config.connectionDataSource}.default.${config.connectionTableName}`
);
queryStr = queryStr.replaceAll('{s3_bucket_location}', config.connectionLocation);
// We append to this URI in internal queries, so we normalize it to have no trailing slash
let trimmedLocation = config.connectionLocation.trim();
trimmedLocation = trimmedLocation.endsWith('/')
? trimmedLocation.slice(0, trimmedLocation.length - 1)
: trimmedLocation;

queryStr = queryStr.replaceAll('{s3_bucket_location}', trimmedLocation);
queryStr = queryStr.replaceAll('{object_name}', config.connectionTableName);
queryStr = queryStr.replaceAll(/\s+/g, ' ');
const result = await runQuery(queryStr, config.connectionDataSource, sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ SELECT
classification as `aws.elb.classification`,
classification_reason as `aws.elb.classification_reason`
FROM
{table_name};
{table_name}
WITH (
auto_refresh = 'true',
checkpoint_location = '{s3_bucket_location}/checkpoint',
watermark_delay = '1 Minute',
extra_options = '{ "{table_name}": { "maxFilesPerTrigger": "10" }}'
);

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@
"name": "create_mv",
"version": "1.0.0",
"language": "sql"
},
{
"name": "refresh_mv",
"version": "1.0.0",
"language": "sql"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ CREATE MATERIALIZED VIEW {table_name}_mview AS
ELSE 'egress'
END AS `aws.vpc.flow-direction`
FROM
{table_name};
{table_name}
WITH (
auto_refresh = 'true',
checkpoint_location = '{s3_bucket_location}/checkpoint',
watermark_delay = '1 Minute',
extra_options = '{ "{table_name}": { "maxFilesPerTrigger": "10" }}'
)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
"name": "create_mv_vpc",
"version": "1.0.0",
"language": "sql"
},
{
"name": "refresh_mv_vpc",
"version": "1.0.0",
"language": "sql"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ SELECT
body_bytes_sent AS `http.response.bytes`,
'nginx.access' AS `event.domain`
FROM {table_name}
WITH (
auto_refresh = 'true',
checkpoint_location = '{s3_bucket_location}/checkpoint',
watermark_delay = '1 Minute',
extra_options = '{ "{table_name}": { "maxFilesPerTrigger": "10" }}'
);

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@
"name": "create_mv",
"version": "1.0.0",
"language": "sql"
},
{
"name": "refresh_mv",
"version": "1.0.0",
"language": "sql"
}
]
},
Expand Down

0 comments on commit 80f112a

Please sign in to comment.