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
Copy file name to clipboardExpand all lines: docs/sqlalchemy.md
+6-16Lines changed: 6 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,34 +102,24 @@ A throttling or permission error from a table-metadata lookup never by itself es
102
102
For failed metadata requests, the error response establishes absence only when it is a recognized `EntityNotFoundException`; an unrecognized error is never guessed to mean a missing table.
103
103
The `information_schema` queries described below can still establish absence after a failed request, from the query's result rather than from the error.
104
104
Column reflection and `has_table()` do not retry a table-metadata request that `information_schema` can answer; they read `information_schema.columns` instead, executed without query result reuse, and log a warning.
105
-
That covers a throttled request in any catalog.
105
+
That covers a throttled request in any catalog that the cursor's Glue fallback, described below, does not answer.
106
106
It also covers a `MetadataException` carrying no recognized Glue error envelope, but only outside `AwsDataCatalog`: a federated catalog reports a missing table in its connector's own words, so absence is decided by the query against that catalog rather than by an unrecognized message.
107
107
In `AwsDataCatalog` an unrecognized `MetadataException` still propagates, because Glue does state missing tables and permission failures in a recognized envelope, and `information_schema` filters by Lake Formation instead of failing, so reading it there would report a table the caller cannot see as absent.
108
108
Other error codes listed in the connection's `RetryConfig.exceptions` are still retried on that path, except those; list the wrapped Glue codes instead of `MetadataException`.
109
109
A `retry_config` in `cursor_kwargs` replaces that policy entirely, including those retries, which then run before the fallback.
110
110
The fallback maps unbounded `varchar` to SQLAlchemy `String`, matching Hive `STRING` reflection from the metadata API, and preserves explicit `VARCHAR(n)` and `CHAR(n)` lengths.
111
111
Partition columns are marked from the `extra_info` column.
112
112
This fallback does not populate the table-metadata cache.
113
-
Table comments and table options still come from the metadata API with the configured retries, apart from the Glue fallback described below.
113
+
Table comments and table options still come from the metadata API with the configured retries.
114
114
When that request fails, they raise `NoSuchTableError` for a recognized `EntityNotFoundException` and propagate any other error, except that for an unrecognized `MetadataException` outside `AwsDataCatalog` they query `information_schema.columns` and raise `NoSuchTableError` if it has no row for the table.
115
115
The query is skipped when column reflection in the same Inspector has already read the table's columns from `information_schema`.
116
116
The dialect runs its own queries — this fallback and `get_view_definition()` — through the API cursor, whatever `cursor_class` or `unload` setting the connection carries, because it parses those result rows itself.
117
117
118
-
In `AwsDataCatalog` and S3 Tables catalogs (`s3tablescatalog/<table-bucket>`), a throttled request for table comments, table options, table and view names, or schema names is answered from the AWS Glue Data Catalog instead, and a warning is logged.
119
-
The request goes to Glue on the first throttled response, without waiting for the retry policy; a `retry_config` in `cursor_kwargs` still runs its retries first.
120
-
The Glue client uses the connection's session, region, and botocore `config`, but not its `endpoint_url`.
118
+
In `AwsDataCatalog` and S3 Tables catalogs, the cursor answers a throttled metadata request from the AWS Glue Data Catalog, as described in {ref}`usage-table-metadata`.
119
+
Reflection of columns, `has_table()`, table comments, table options, and table, view, and schema names uses it, so these need the Glue permissions listed there.
121
120
A table that Glue reports as missing raises `NoSuchTableError`.
122
-
If the Glue request fails, for example for lack of permission or because the Glue endpoint cannot be reached, the Athena request runs again with the configured retries.
123
-
Column reflection and `has_table()` keep the `information_schema` fallback.
124
-
The fallback calls these Glue APIs with the connection's credentials:
125
-
126
-
| Reflection | Glue API | IAM action |
127
-
|---|---|---|
128
-
| Table comments and table options |`GetTable`|`glue:GetTable`|
129
-
| Table and view names |`GetTables`|`glue:GetTables`|
Copy file name to clipboardExpand all lines: docs/usage.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -661,6 +661,30 @@ heuristic behavior may see string values where it previously saw integers or flo
661
661
To restore typed conversion, pass `result_set_type_hints` with the appropriate type
662
662
signatures for the affected columns.
663
663
664
+
(usage-table-metadata)=
665
+
666
+
## Table and database metadata
667
+
668
+
`get_table_metadata()`, `list_table_metadata()`, and `list_databases()` call the Athena metadata API.
669
+
Athena applies its metadata API rate limits per account, and they are not listed in Service Quotas.
670
+
In `AwsDataCatalog` and S3 Tables catalogs (`s3tablescatalog/<table-bucket>`), a throttled request is answered from the AWS Glue Data Catalog instead, and a warning is logged.
671
+
The request goes to Glue on the first throttled response, without waiting for the retry policy.
672
+
Glue throttling that Athena reports inside a `MetadataException` counts as throttled.
673
+
The fallback calls these Glue APIs with the connection's credentials:
Glue's report that a table or database does not exist raises `OperationalError`, as Athena's does.
682
+
If the Glue request fails for any other reason, for example for lack of permission or because the Glue endpoint cannot be reached, a second warning is logged and the Athena request runs again with the retry policy.
683
+
Requests in other catalogs use the Athena API with the retry policy only.
684
+
685
+
The connection builds one Glue client on first use from its session, region, and botocore `config`, but not its `endpoint_url`, and exposes it as `Connection.glue_client`.
686
+
Pass `glue_metadata_fallback=False` to `connect()` to turn the fallback off.
687
+
664
688
## Environment variables
665
689
666
690
Support [Boto3 environment variables](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-environment-variables).
0 commit comments