amazon-redshift

How to Insert TIMESTAMP Column into Redshift

落花浮王杯 提交于 2021-02-06 10:14:05
问题 I created a table in Redshift: create table myTable ( dateTime TIMESTAMP NOT NULL, ... ); However, when I try to insert a record that contains a dateTime of, I get an error from stl_load_errors . 20080215 04:05:06.789 Since I took this timestamp from the docs, I would've expected it to have worked. The error logs from Redshift show: Invalid timestamp format or value [YYYY-MM-DD HH24:MI:SS] However, I'd like to include 3 extra seconds, example: 2015-02-01 15:49:35.123 . How do I need to modify

How to Insert TIMESTAMP Column into Redshift

折月煮酒 提交于 2021-02-06 10:13:03
问题 I created a table in Redshift: create table myTable ( dateTime TIMESTAMP NOT NULL, ... ); However, when I try to insert a record that contains a dateTime of, I get an error from stl_load_errors . 20080215 04:05:06.789 Since I took this timestamp from the docs, I would've expected it to have worked. The error logs from Redshift show: Invalid timestamp format or value [YYYY-MM-DD HH24:MI:SS] However, I'd like to include 3 extra seconds, example: 2015-02-01 15:49:35.123 . How do I need to modify

How to Insert TIMESTAMP Column into Redshift

风流意气都作罢 提交于 2021-02-06 10:13:02
问题 I created a table in Redshift: create table myTable ( dateTime TIMESTAMP NOT NULL, ... ); However, when I try to insert a record that contains a dateTime of, I get an error from stl_load_errors . 20080215 04:05:06.789 Since I took this timestamp from the docs, I would've expected it to have worked. The error logs from Redshift show: Invalid timestamp format or value [YYYY-MM-DD HH24:MI:SS] However, I'd like to include 3 extra seconds, example: 2015-02-01 15:49:35.123 . How do I need to modify

How to handle Slowly Changing Dimension Type 2 in Redshift?

柔情痞子 提交于 2021-02-06 05:00:55
问题 I want to track username changes overtime. I have the following users table in Redshift: id username valid_from valid_to current -------------------------------------------------------- 1 joe1 2015-01-01 2015-01-15 No 1 joe2 2015-01-15 NULL Yes My source data is from RDS Postgres. I'm thinking of several options on how to handle this: 1) Create users_history table and start tracking this inside RDS Postgres db. This requires me making changes to my app and this table potentially can get huge

How to handle Slowly Changing Dimension Type 2 in Redshift?

夙愿已清 提交于 2021-02-06 04:59:29
问题 I want to track username changes overtime. I have the following users table in Redshift: id username valid_from valid_to current -------------------------------------------------------- 1 joe1 2015-01-01 2015-01-15 No 1 joe2 2015-01-15 NULL Yes My source data is from RDS Postgres. I'm thinking of several options on how to handle this: 1) Create users_history table and start tracking this inside RDS Postgres db. This requires me making changes to my app and this table potentially can get huge

Redshift regexp_substr

被刻印的时光 ゝ 提交于 2021-02-04 20:55:29
问题 I want to replicate this regex pattern to regexp_substr. I want to capture the second group. '(\?)(.*?)(&|$)' I have tried this regexp(my_url, '\\?.*?&|$') And some similar variations of the above, but I have been getting the errror: ERROR: XX000: Invalid preceding regular expression prior to repetition operator. The error occured while parsing the regular expression: '\?.*?>>>HERE>>>&|$'. 回答1: Since Amazon Redshift supports only POSIX regex, you need to use greedy quantifiers rather than

'Column is of type timestamp without time zone but expression is of type interval' Redshift

£可爱£侵袭症+ 提交于 2021-01-29 18:07:13
问题 I have one column of timezone names. I want to get another column with the time difference compared to UTC time. But I don't know which data type I should use for this offset column when creating the table. I used: CREATE TABLE zone_offset( zone_name varchar(50), zone_utc_diff timestamp ); INSERT INTO zone_offset SELECT zone_name, getdate() - getdate() at time zone zone_name AS zone_utc_diff FROM zones and I got that error. How can I make it work with whatever datatype? Thank you very much in

Redshift timestamp timezone

孤者浪人 提交于 2021-01-29 16:46:11
问题 What's the best practise for storing timestamp values in a timestamp column. When copying from parquet timestamps are getting converted to UTC but not with other file formats. According to documentation Redshift stores timestamps in UTC, in that case is it advisable to convert timestamps to UTC while copying from CSV or formats other than parquet? Would like to know what everyone is doing in their organisation and what's the best practise. Thanks, mc 来源: https://stackoverflow.com/questions

Can not copy data from s3 to redshift cluster in a private subnet

烈酒焚心 提交于 2021-01-29 14:31:38
问题 I have set up a redshift cluster in a private subnet. I can successfully connect to my redshift cluster and do basic SQL queries through DBeaver. I need to upload some file from s3 to redshift as well, so I set up a s3 gateway in my private subnet and updated the route table for my private subnet to add the required route as follow: Destination Target Status Propagated 192.168.0.0/16 local active No pl-7ba54012 (com.amazonaws.us-east-2.s3, 52.219.80.0/20, 3.5.128.0/21, 52.219.96.0/20, 52.92

Extract Embedded AWS Glue Connection Credentials Using Scala

我的未来我决定 提交于 2021-01-29 14:17:51
问题 I have a glue job that reads directly from redshift, and to do that, one has to provide connection credentials. I have created an embedded glue connection and can extract the credentials with the following pyspark code. Is there a way to do this in Scala ? glue = boto3.client('glue', region_name='us-east-1') response = glue.get_connection( Name='name-of-embedded-connection', HidePassword=False ) table = spark.read.format( 'com.databricks.spark.redshift' ).option( 'url', 'jdbc:redshift://prod