forked from awsdocs/amazon-redshift-developer-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
216 changed files
with
6,539 additions
and
2,036 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# ST\_GeomFromGeoHash<a name="ST_GeomFromGeoHash-function"></a> | ||
|
||
ST\_GeomFromGeoHash constructs a geometry object from the geohash representation of an input geometry\. ST\_GeomFromGeoHash returns a two\-dimensional \(2D\) geometry with the spatial reference identifier \(SRID\) of zero \(0\)\. For more information about the geohash format, see [Geohash](https://en.wikipedia.org/wiki/Geohash) in Wikipedia\. | ||
|
||
## Syntax<a name="ST_GeomFromGeoHash-function-syntax"></a> | ||
|
||
``` | ||
ST_GeomFromGeoHash(geohash_string) | ||
``` | ||
|
||
``` | ||
ST_GeomFromGeoHash(geohash_string, precision) | ||
``` | ||
|
||
## Arguments<a name="ST_GeomFromGeoHash-function-arguments"></a> | ||
|
||
*geohash\_string* | ||
A value of data type `VARCHAR` or an expression that evaluates to a `VARCHAR` type, that is a geohash representation of a geometry\. | ||
|
||
*precision* | ||
A value of data type `INTEGER` that represents the precision of the geohash\. The value is the number of characters of the geohash to be used as precision\. If the value is not specified, less than zero, or greater than the *geohash\_string* length\. then the *geohash\_string* length is used\. | ||
|
||
## Return type<a name="ST_GeomFromGeoHash-function-return"></a> | ||
|
||
`GEOMETRY` | ||
|
||
If *geohash\_string* is null, then null is returned\. | ||
|
||
If *geohash\_string* is not valid, then an error is returned\. | ||
|
||
## Examples<a name="ST_GeomFromGeoHash-function-examples"></a> | ||
|
||
The following SQL returns a polygon with high precision\. | ||
|
||
``` | ||
SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz0')); | ||
``` | ||
|
||
``` | ||
st_asewkt | ||
----------------------- | ||
POLYGON((-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646,-115.172816 36.114646)) | ||
``` | ||
|
||
The following SQL returns a point with high precision\. | ||
|
||
``` | ||
SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz00')); | ||
``` | ||
|
||
``` | ||
st_asewkt | ||
----------------------- | ||
POINT(-115.172816 36.114646) | ||
``` | ||
|
||
The following SQL returns a polygon with low precision\. | ||
|
||
``` | ||
SELECT ST_AsText(ST_GeomFromGeoHash('9qq')); | ||
``` | ||
|
||
``` | ||
st_asewkt | ||
----------------------- | ||
POLYGON((-115.3125 35.15625,-115.3125 36.5625,-113.90625 36.5625,-113.90625 35.15625,-115.3125 35.15625)) | ||
``` | ||
|
||
The following SQL returns a polygon with precision 3\. | ||
|
||
``` | ||
SELECT ST_AsText(ST_GeomFromGeoHash('9qqj7nmxncgyy4d0dbxqz0', 3)); | ||
``` | ||
|
||
``` | ||
st_asewkt | ||
----------------------- | ||
POLYGON((-115.3125 35.15625,-115.3125 36.5625,-113.90625 36.5625,-113.90625 35.15625,-115.3125 35.15625)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# ST\_GeomFromGeoJSON<a name="ST_GeomFromGeoJSON-function"></a> | ||
|
||
ST\_GeomFromGeoJSON constructs a geometry object from the GeoJSON representation of an input geometry\. For more information about the GeoJSON format, see [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) in Wikipedia\. | ||
|
||
If there is at least one point with three or more coordinates, the resulting geometry is 3DZ, where the Z component is zero for the points that have only two coordinates\. If all points in the input GeoJSON contain two coordinates or are empty, ST\_GeomFromGeoJSON returns a 2D geometry\. The returned geometry always has the spatial reference identifier \(SRID\) of 4326\. | ||
|
||
## Syntax<a name="ST_GeomFromGeoJSON-function-syntax"></a> | ||
|
||
``` | ||
ST_GeomFromGeoJSON(geojson_string) | ||
``` | ||
|
||
## Arguments<a name="ST_GeomFromGeoJSON-function-arguments"></a> | ||
|
||
*geojson\_string* | ||
A value of data type `VARCHAR` or an expression that evaluates to a `VARCHAR` type, that is a GeoJSON representation of a geometry\. | ||
|
||
## Return type<a name="ST_GeomFromGeoJSON-function-return"></a> | ||
|
||
`GEOMETRY` | ||
|
||
If *geojson\_string* is null, then null is returned\. | ||
|
||
If *geojson\_string* is not valid, then an error is returned\. | ||
|
||
## Examples<a name="ST_GeomFromGeoJSON-function-examples"></a> | ||
|
||
The following SQL returns a 2D geometry represented in the input GeoJSON\. | ||
|
||
``` | ||
SELECT ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1,2]}')); | ||
``` | ||
|
||
``` | ||
st_asewkt | ||
----------------------- | ||
SRID=4326;POINT(1 2) | ||
``` | ||
|
||
The following SQL returns a 3DZ geometry represented in the input GeoJSON\. | ||
|
||
``` | ||
SELECT ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[1,2,3],[4,5,6],[7,8,9]]}')); | ||
``` | ||
|
||
``` | ||
st_asewkt | ||
------------------------------------------ | ||
SRID=4326;LINESTRING Z (1 2 3,4 5 6,7 8 9) | ||
``` | ||
|
||
The following SQL returns 3DZ geometry when only one point has three coordinates while all other points have two coordinates in the input GeoJSON\. | ||
|
||
``` | ||
SELECT ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[[[0, 0],[0, 1, 8],[1, 0],[0, 0]]]}')); | ||
``` | ||
|
||
``` | ||
st_asewkt | ||
------------------------------------------------ | ||
SRID=4326;POLYGON Z ((0 0 0,0 1 8,1 0 0,0 0 0)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# SYS\_CONNECTION\_LOG<a name="SYS_CONNECTION_LOG"></a> | ||
|
||
Logs authentication attempts and connections and disconnections\. | ||
|
||
This view is visible only to superusers\. For more information, see [Visibility of data in system tables and views](c_visibility-of-data.md)\. | ||
|
||
## Table columns<a name="SYS_CONNECTION_LOG-table-columns2"></a> | ||
|
||
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_CONNECTION_LOG.html) | ||
|
||
## Sample queries<a name="SYS_CONNECTION_LOG-sample-queries2"></a> | ||
|
||
To view the details for open connections, run the following query\. | ||
|
||
``` | ||
select record_time, user_name, database_name, remote_host, remote_port | ||
from sys_connection_log | ||
where event = 'initiating session' | ||
and session_id not in | ||
(select session_id from sys_connection_log | ||
where event = 'disconnecting session') | ||
order by 1 desc; | ||
record_time | user_name | database_name | remote_host | remote_port | ||
--------------------+-------------+-----------------+---------------+--------------------------------- | ||
2014-11-06 20:30:06 | rdsdb | dev | [local] | | ||
2014-11-06 20:29:37 | test001 | test | 10.49.42.138 | 11111 | ||
2014-11-05 20:30:29 | rdsdb | dev | 10.49.42.138 | 33333 | ||
2014-11-05 20:28:35 | rdsdb | dev | [local] | | ||
(4 rows) | ||
``` | ||
|
||
The following example reflects a failed authentication attempt and a successful connection and disconnection\. | ||
|
||
``` | ||
select event, record_time, remote_host, user_name | ||
from sys_connection_log order by record_time; | ||
event | record_time | remote_host | user_name | ||
-----------------------+----------------------------+---------------+--------- | ||
authentication failure | 2012-10-25 14:41:56.96391 | 10.49.42.138 | john | ||
authenticated | 2012-10-25 14:42:10.87613 | 10.49.42.138 | john | ||
initiating session | 2012-10-25 14:42:10.87638 | 10.49.42.138 | john | ||
disconnecting session | 2012-10-25 14:42:19.95992 | 10.49.42.138 | john | ||
(4 rows) | ||
``` | ||
|
||
The following example shows the version of the ODBC driver, the operating system on the client machine, and the plugin used to connect to the Amazon Redshift cluster\. In this example, the plugin used is for standard ODBC driver authentication using a login name and password\. | ||
|
||
``` | ||
select driver_version, os_version, plugin_name from sys_connection_log; | ||
driver_version | os_version | plugin_name | ||
----------------------------------------+-----------------------------------+-------------------- | ||
Amazon Redshift ODBC Driver 1.4.15.0001 | Darwin 18.7.0 x86_64 | none | ||
Amazon Redshift ODBC Driver 1.4.15.0001 | Linux 4.15.0-101-generic x86_64 | none | ||
``` | ||
|
||
The following example shows the version of the operating system on the client machine, the driver version, and the protocol version\. | ||
|
||
``` | ||
select os_version, driver_version, protocol_version from sys_connection_log; | ||
os_version | driver_version | protocol_version | ||
--------------------------------+------------------------------+-------------------- | ||
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2 | ||
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2 | ||
Linux 4.15.0-101-generic x86_64 | Redshift JDBC Driver 2.0.0.0 | 2 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# SYS\_COPY\_JOB \(preview\)<a name="SYS_COPY_JOB"></a> | ||
|
||
|
||
| | | ||
| --- | | ||
| This is prerelease documentation for auto\-copy \(SQL COPY JOB\), which is in preview release\. The documentation and the feature are both subject to change\. We recommend that you use this feature only in test environments, and not in production environments\. Public preview will end on February 28, 2023\. Preview clusters and preview serverless workgroups and namespaces will be removed automatically two weeks after the end of the preview\. For preview terms and conditions, see Betas and Previews in [AWS Service Terms](https://aws.amazon.com/service-terms/)\. | | ||
|
||
Use SYS\_COPY\_JOB to view details of COPY JOB commands\. | ||
|
||
This view contains the COPY JOB commands that have been created\. | ||
|
||
SYS\_COPY\_JOB is visible to all users\. Superusers can see all rows; regular users can see only metadata to which they have access\. | ||
|
||
## Table columns<a name="SYS_COPY_JOB-table-columns"></a> | ||
|
||
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_COPY_JOB.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SYS\_DATASHARE\_CHANGE\_LOG<a name="SYS_DATASHARE_CHANGE_LOG"></a> | ||
|
||
Records the consolidated view for tracking changes to datashares on both producer and consumer clusters\. | ||
|
||
Superusers can see all rows; regular users can see only their own data\. | ||
|
||
## Table columns<a name="SYS_DATASHARE_CHANGE_LOG-table-rows"></a> | ||
|
||
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_DATASHARE_CHANGE_LOG.html) | ||
|
||
## Sample queries<a name="SYS_DATASHARE_CHANGE_LOG-sample-queries"></a> | ||
|
||
The following example shows a SYS\_DATASHARE\_CHANGE\_LOG view\. | ||
|
||
``` | ||
SELECT DISTINCT action | ||
FROM sys_datashare_change_log | ||
WHERE share_object_name LIKE 'tickit%'; | ||
action | ||
----------------------- | ||
"ALTER DATASHARE ADD" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# SYS\_DATASHARE\_USAGE\_CONSUMER<a name="SYS_DATASHARE_USAGE_CONSUMER"></a> | ||
|
||
Records the activity and usage of datashares\. This view is only relevant on the consumer cluster\. | ||
|
||
SYS\_DATASHARE\_USAGE\_CONSUMER is visible to all users\. | ||
|
||
## Table columns<a name="SYS_DATASHARE_USAGE_CONSUMER-table-rows"></a> | ||
|
||
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/redshift/latest/dg/SYS_DATASHARE_USAGE_CONSUMER.html) | ||
|
||
## Sample queries<a name="SYS_DATASHARE_USAGE_CONSUMER-sample-queries"></a> | ||
|
||
The following example shows a SYS\_DATASHARE\_USAGE\_CONSUMER view\. | ||
|
||
``` | ||
SELECT request_type, status, trim(error) AS error | ||
FROM sys_datashare_usage_consumer | ||
request_type | status | error | ||
----------------+--------+-------- | ||
"GET RELATION" | 0 | | ||
``` |
Oops, something went wrong.