You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(glue): add ExternalTable for use with connections (#24753)
Changing the table structure to include an initial `TableBase` abstract class, allowing different tables of different data sources to be created from. Initially there are two, `S3Table` and `ExternalTable`.
- `S3Table`: The current table structure that has been used throughout the previous versions of the CDK
- `ExternalTable`: The new glue table that will be used to store metadata about external data sources. This subclass will contain an `externalDataLocation` property to explicitly specify the `Location` property of the underlying `CfnTable` L1 construct
- `Table`: This is now `@deprecated` to shift the usage towards `S3Table`
Closes#24741.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@@ -269,7 +269,7 @@ To improve query performance, a table can specify `partitionKeys` on which data
269
269
270
270
```ts
271
271
declareconst myDatabase:glue.Database;
272
-
newglue.Table(this, 'MyTable', {
272
+
newglue.S3Table(this, 'MyTable', {
273
273
database: myDatabase,
274
274
columns: [{
275
275
name: 'col1',
@@ -300,7 +300,7 @@ property:
300
300
301
301
```ts
302
302
declareconst myDatabase:glue.Database;
303
-
newglue.Table(this, 'MyTable', {
303
+
newglue.S3Table(this, 'MyTable', {
304
304
database: myDatabase,
305
305
columns: [{
306
306
name: 'col1',
@@ -337,7 +337,7 @@ If you have a table with a large number of partitions that grows over time, cons
337
337
338
338
```ts
339
339
declareconst myDatabase:glue.Database;
340
-
newglue.Table(this, 'MyTable', {
340
+
newglue.S3Table(this, 'MyTable', {
341
341
database: myDatabase,
342
342
columns: [{
343
343
name: 'col1',
@@ -355,6 +355,28 @@ new glue.Table(this, 'MyTable', {
355
355
});
356
356
```
357
357
358
+
### Glue Connections
359
+
360
+
Glue connections allow external data connections to third party databases and data warehouses. However, these connections can also be assigned to Glue Tables, allowing you to query external data sources using the Glue Data Catalog.
361
+
362
+
Whereas `S3Table` will point to (and if needed, create) a bucket to store the tables' data, `ExternalTable` will point to an existing table in a data source. For example, to create a table in Glue that points to a table in Redshift:
363
+
364
+
```ts
365
+
declareconst myConnection:glue.Connection;
366
+
declareconst myDatabase:glue.Database;
367
+
newglue.ExternalTable(this, 'MyTable', {
368
+
connection: myConnection,
369
+
externalDataLocation: 'default_db_public_example', // A table in Redshift
@@ -363,7 +385,7 @@ You can enable encryption on a Table's data:
363
385
364
386
```ts
365
387
declareconst myDatabase:glue.Database;
366
-
newglue.Table(this, 'MyTable', {
388
+
newglue.S3Table(this, 'MyTable', {
367
389
encryption: glue.TableEncryption.S3_MANAGED,
368
390
// ...
369
391
database: myDatabase,
@@ -380,7 +402,7 @@ new glue.Table(this, 'MyTable', {
380
402
```ts
381
403
declareconst myDatabase:glue.Database;
382
404
// KMS key is created automatically
383
-
newglue.Table(this, 'MyTable', {
405
+
newglue.S3Table(this, 'MyTable', {
384
406
encryption: glue.TableEncryption.KMS,
385
407
// ...
386
408
database: myDatabase,
@@ -392,7 +414,7 @@ new glue.Table(this, 'MyTable', {
392
414
});
393
415
394
416
// with an explicit KMS key
395
-
newglue.Table(this, 'MyTable', {
417
+
newglue.S3Table(this, 'MyTable', {
396
418
encryption: glue.TableEncryption.KMS,
397
419
encryptionKey: newkms.Key(this, 'MyKey'),
398
420
// ...
@@ -409,7 +431,7 @@ new glue.Table(this, 'MyTable', {
409
431
410
432
```ts
411
433
declareconst myDatabase:glue.Database;
412
-
newglue.Table(this, 'MyTable', {
434
+
newglue.S3Table(this, 'MyTable', {
413
435
encryption: glue.TableEncryption.KMS_MANAGED,
414
436
// ...
415
437
database: myDatabase,
@@ -426,7 +448,7 @@ new glue.Table(this, 'MyTable', {
426
448
```ts
427
449
declareconst myDatabase:glue.Database;
428
450
// KMS key is created automatically
429
-
newglue.Table(this, 'MyTable', {
451
+
newglue.S3Table(this, 'MyTable', {
430
452
encryption: glue.TableEncryption.CLIENT_SIDE_KMS,
431
453
// ...
432
454
database: myDatabase,
@@ -438,7 +460,7 @@ new glue.Table(this, 'MyTable', {
438
460
});
439
461
440
462
// with an explicit KMS key
441
-
newglue.Table(this, 'MyTable', {
463
+
newglue.S3Table(this, 'MyTable', {
442
464
encryption: glue.TableEncryption.CLIENT_SIDE_KMS,
443
465
encryptionKey: newkms.Key(this, 'MyKey'),
444
466
// ...
@@ -451,15 +473,15 @@ new glue.Table(this, 'MyTable', {
451
473
});
452
474
```
453
475
454
-
*Note: you cannot provide a `Bucket` when creating the `Table` if you wish to use server-side encryption (`KMS`, `KMS_MANAGED` or `S3_MANAGED`)*.
476
+
*Note: you cannot provide a `Bucket` when creating the `S3Table` if you wish to use server-side encryption (`KMS`, `KMS_MANAGED` or `S3_MANAGED`)*.
455
477
456
478
## Types
457
479
458
480
A table's schema is a collection of columns, each of which have a `name` and a `type`. Types are recursive structures, consisting of primitive and complex types:
0 commit comments