amazon-redshift

Error while using regexp_split_to_table (Amazon Redshift)

﹥>﹥吖頭↗ 提交于 2020-01-10 02:03:28
问题 I have the same question as this: Splitting a comma-separated field in Postgresql and doing a UNION ALL on all the resulting tables Just that my 'fruits' column is delimited by '|'. When I try: SELECT yourTable.ID, regexp_split_to_table(yourTable.fruits, E'|') AS split_fruits FROM yourTable I get the following: ERROR: type "e" does not exist Q1. What does the E do? I saw some examples where E is not used. The official docs don't explain it in their "quick brown fox..." example. Q2. How do I

Error while using regexp_split_to_table (Amazon Redshift)

≯℡__Kan透↙ 提交于 2020-01-10 02:03:13
问题 I have the same question as this: Splitting a comma-separated field in Postgresql and doing a UNION ALL on all the resulting tables Just that my 'fruits' column is delimited by '|'. When I try: SELECT yourTable.ID, regexp_split_to_table(yourTable.fruits, E'|') AS split_fruits FROM yourTable I get the following: ERROR: type "e" does not exist Q1. What does the E do? I saw some examples where E is not used. The official docs don't explain it in their "quick brown fox..." example. Q2. How do I

Fetch rows based on condition

狂风中的少年 提交于 2020-01-07 03:51:10
问题 I am using PostgreSQL on Amazon Redshift. My table is : drop table APP_Tax; create temp table APP_Tax(APP_nm varchar(100),start timestamp,end1 timestamp); insert into APP_Tax values('AFH','2018-01-26 00:39:51','2018-01-26 00:39:55'), ('AFH','2016-01-26 00:39:56','2016-01-26 00:40:01'), ('AFH','2016-01-26 00:40:05','2016-01-26 00:40:11'), ('AFH','2016-01-26 00:40:12','2016-01-26 00:40:15'), --row x ('AFH','2016-01-26 00:40:35','2016-01-26 00:41:34') --row y Expected output: 'AFH','2016-01-26

Avro file error while loading decimal field into Redshift table using Databricks

自作多情 提交于 2020-01-06 07:02:10
问题 I have a dataframe in Databricks, which has bunch of columns including a decimal(15,2) field. If I exclude the decimal field then I am able to insert this data into the Redshift table, but when decimal field is included then I get following error: "Cannot init avro reader from s3 file Cannot parse file header: Cannot save fixed schema" Any thoughts? 回答1: Try to use just decimal without range. Or cast existing column to decimal . Also try to use different tempformat . From my experience CSV

Spark 2.4.0 dependencies to write to AWS Redshift

◇◆丶佛笑我妖孽 提交于 2020-01-06 06:55:00
问题 I'm struggling to find the correct packages dependency and their relative version to write to a Redshfit DB with a Pyspark micro-batch approach. What are the correct dependencies to achieve this goal? 回答1: As suggested from AWS tutorial is necessary to provide a JDBC driver wget https://s3.amazonaws.com/redshift-downloads/drivers/jdbc/1.2.20.1043/RedshiftJDBC4-no-awssdk-1.2.20.1043.jar After this jar has been downloaded and make it available to the spark-submit command, this is how I provided

Spark 2.4.0 dependencies to write to AWS Redshift

霸气de小男生 提交于 2020-01-06 06:54:05
问题 I'm struggling to find the correct packages dependency and their relative version to write to a Redshfit DB with a Pyspark micro-batch approach. What are the correct dependencies to achieve this goal? 回答1: As suggested from AWS tutorial is necessary to provide a JDBC driver wget https://s3.amazonaws.com/redshift-downloads/drivers/jdbc/1.2.20.1043/RedshiftJDBC4-no-awssdk-1.2.20.1043.jar After this jar has been downloaded and make it available to the spark-submit command, this is how I provided

Pandas - Error inserting text column into Redshift table

痞子三分冷 提交于 2020-01-06 06:41:40
问题 I am trying to insert a text column of into a Redshift DB. I get an error DataError: value too long for type character varying(256) Given below is the code I tried. The description column has text and the length goes upto 2000 characters. Could anyone assist on how I could have this column inserted into the table. DF['description'] = DF['description'].str[:200].astype(str) Could anyone assist, thanks. 回答1: You should be using str.slice . df['description'] = df['description'].str.slice(0,255)

Pandas - Error inserting text column into Redshift table

六眼飞鱼酱① 提交于 2020-01-06 06:41:14
问题 I am trying to insert a text column of into a Redshift DB. I get an error DataError: value too long for type character varying(256) Given below is the code I tried. The description column has text and the length goes upto 2000 characters. Could anyone assist on how I could have this column inserted into the table. DF['description'] = DF['description'].str[:200].astype(str) Could anyone assist, thanks. 回答1: You should be using str.slice . df['description'] = df['description'].str.slice(0,255)

How can I modify the SQL generated by ServiceStack.OrmLite?

蹲街弑〆低调 提交于 2020-01-05 10:10:57
问题 I want to use ServiceStack's OrmLite in C# to query AWS RedShift. AWS RedShift uses the postgresql wire protocol as its query interface, and puts some constraints on the queries that can be run, one of which is that it cannot accept parameterised queries (I've been told; I haven't actually been able to find this backed up in documentation yet). So, I am investigating whether it would be possible to use an ORM to generate parameterised SQL, then find/replace in the parameter values. How can I

aws lambda error loading redshift jdbc driver

邮差的信 提交于 2020-01-05 08:31:52
问题 I get below error when trying to load Redshift jdbc jar from Aws Lambda. java.io.IOException: Unable to load driver: JAR expected but not found. java.sql.SQLException: No suitable driver found for jdbc:redshift://insightlyanalytics.c0ubofza4jil.us-west-2.redshift.amazonaws.com:5439/analytics;user=xxxh;password=xxx at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:270) at com.insightly.GeoPerformanceReports