diff --git a/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/SnowflakeDataType.java b/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/SnowflakeDataType.java index babe7dc8ac7b..e15194b4356d 100644 --- a/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/SnowflakeDataType.java +++ b/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/SnowflakeDataType.java @@ -28,6 +28,7 @@ import org.apache.beam.sdk.io.snowflake.data.datetime.SnowflakeTimestampLTZ; import org.apache.beam.sdk.io.snowflake.data.datetime.SnowflakeTimestampNTZ; import org.apache.beam.sdk.io.snowflake.data.datetime.SnowflakeTimestampTZ; +import org.apache.beam.sdk.io.snowflake.data.geospatial.SnowflakeGeography; import org.apache.beam.sdk.io.snowflake.data.logical.SnowflakeBoolean; import org.apache.beam.sdk.io.snowflake.data.numeric.SnowflakeDecimal; import org.apache.beam.sdk.io.snowflake.data.numeric.SnowflakeDouble; @@ -73,6 +74,7 @@ @Type(value = SnowflakeText.class, name = "text"), @Type(value = SnowflakeVarBinary.class, name = "varbinary"), @Type(value = SnowflakeVarchar.class, name = "varchar"), + @Type(value = SnowflakeGeography.class, name = "geography"), }) public interface SnowflakeDataType extends Serializable { String sql(); diff --git a/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/geospatial/SnowflakeGeography.java b/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/geospatial/SnowflakeGeography.java new file mode 100644 index 000000000000..4ab49e6f5938 --- /dev/null +++ b/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/geospatial/SnowflakeGeography.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.beam.sdk.io.snowflake.data.geospatial; + +import org.apache.beam.sdk.io.snowflake.data.SnowflakeDataType; + +public class SnowflakeGeography implements SnowflakeDataType { + public SnowflakeGeography() {} + + public static SnowflakeGeography of() { + return new SnowflakeGeography(); + } + + @Override + public String sql() { + return "GEOGRAPHY"; + } +} diff --git a/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/geospatial/package-info.java b/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/geospatial/package-info.java new file mode 100644 index 000000000000..54a6a5a1b9b2 --- /dev/null +++ b/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/data/geospatial/package-info.java @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** Snowflake IO geospatial types. */ +package org.apache.beam.sdk.io.snowflake.data.geospatial; diff --git a/sdks/python/apache_beam/io/snowflake.py b/sdks/python/apache_beam/io/snowflake.py index fa797f64f363..c345d7f50793 100644 --- a/sdks/python/apache_beam/io/snowflake.py +++ b/sdks/python/apache_beam/io/snowflake.py @@ -353,41 +353,48 @@ def user_data_mapper(user): CREATE_IF_NEEDED, the table_schema parameter enables specifying the schema for the created target table. A table schema is as JSON with the following structure: - {"schema":[ - { - "dataType":{"type":""}, - "name":" ", - "nullable": - }, - ]} + + .. code-block:: none + + {"schema":[ + { + "dataType":{"type":""}, + "name":"", + "nullable": + }, + ]} All supported data types: - {"schema":[ - {"dataType":{"type":"date"},"name":"","nullable":false}, - {"dataType":{"type":"datetime"},"name":"","nullable":false}, - {"dataType":{"type":"time"},"name":"","nullable":false}, - {"dataType":{"type":"timestamp"},"name":"","nullable":false}, - {"dataType":{"type":"timestamp_ltz"},"name":"","nullable":false}, - {"dataType":{"type":"timestamp_ntz"},"name":"","nullable":false}, - {"dataType":{"type":"timestamp_tz"},"name":"","nullable":false}, - {"dataType":{"type":"boolean"},"name":"","nullable":false}, - {"dataType":{"type":"decimal","precision":38,"scale":1},"name":"","nullable":true}, - {"dataType":{"type":"double"},"name":"","nullable":false}, - {"dataType":{"type":"float"},"name":"","nullable":false}, - {"dataType":{"type":"integer","precision":38,"scale":0},"name":"","nullable":false}, - {"dataType":{"type":"number","precision":38,"scale":1},"name":"","nullable":false}, - {"dataType":{"type":"numeric","precision":38,"scale":2},"name":"","nullable":false}, - {"dataType":{"type":"real"},"name":"","nullable":false}, - {"dataType":{"type":"array"},"name":"","nullable":false}, - {"dataType":{"type":"object"},"name":"","nullable":false}, - {"dataType":{"type":"variant"},"name":"","nullable":true}, - {"dataType":{"type":"binary","size":null},"name":"","nullable":false}, - {"dataType":{"type":"char","length":1},"name":"","nullable":false}, - {"dataType":{"type":"string","length":null},"name":"","nullable":false}, - {"dataType":{"type":"text","length":null},"name":"","nullable":false}, - {"dataType":{"type":"varbinary","size":null},"name":"","nullable":false}, - {"dataType":{"type":"varchar","length":100},"name":"","nullable":false}] - } + + .. code-block:: json + + {"schema":[ + {"dataType":{"type":"date"},"name":"","nullable":false}, + {"dataType":{"type":"datetime"},"name":"","nullable":false}, + {"dataType":{"type":"time"},"name":"","nullable":false}, + {"dataType":{"type":"timestamp"},"name":"","nullable":false}, + {"dataType":{"type":"timestamp_ltz"},"name":"","nullable":false}, + {"dataType":{"type":"timestamp_ntz"},"name":"","nullable":false}, + {"dataType":{"type":"timestamp_tz"},"name":"","nullable":false}, + {"dataType":{"type":"boolean"},"name":"","nullable":false}, + {"dataType":{"type":"decimal","precision":38,"scale":1},"name":"","nullable":true}, + {"dataType":{"type":"double"},"name":"","nullable":false}, + {"dataType":{"type":"float"},"name":"","nullable":false}, + {"dataType":{"type":"integer","precision":38,"scale":0},"name":"","nullable":false}, + {"dataType":{"type":"number","precision":38,"scale":1},"name":"","nullable":false}, + {"dataType":{"type":"numeric","precision":38,"scale":2},"name":"","nullable":false}, + {"dataType":{"type":"real"},"name":"","nullable":false}, + {"dataType":{"type":"array"},"name":"","nullable":false}, + {"dataType":{"type":"object"},"name":"","nullable":false}, + {"dataType":{"type":"variant"},"name":"","nullable":true}, + {"dataType":{"type":"binary","size":null},"name":"","nullable":false}, + {"dataType":{"type":"char","length":1},"name":"","nullable":false}, + {"dataType":{"type":"string","length":null},"name":"","nullable":false}, + {"dataType":{"type":"text","length":null},"name":"","nullable":false}, + {"dataType":{"type":"varbinary","size":null},"name":"","nullable":false}, + {"dataType":{"type":"varchar","length":100},"name":"","nullable":false}, + {"dataType":{"type":"geography"},"name":"","nullable":true}] + } """ verify_credentials( username=username,