amazon-redshift

Is there any way to find table creation date in redshift?

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:16:48
问题 I am having trouble with finding table creation date in Amazon Redshift. I know svv_table_info will give all the info about the table but the creation date.Can anyone help please? 回答1: In Redshift the other ways you can get the create time of your table by searching for the start and stop time of any create table sql run in the svl_qlog. There are other tables you can look at to get similar data but the problem with this way is that it's only kept for a couple of days (3 - 5). Although

in redshift postgresql can I skip columns with the copy function

橙三吉。 提交于 2019-12-22 04:31:13
问题 I have a .csv table (t1) with columns: c1, c2, c3 in amazon S3 storage I want to copy that into amazon redshift I create the table with columns: c1, c2, c3 where all columns are nullable I copy with command: copy t1a (c1,c3) from t1 I expected it would copy c1 and c3 over from t1 and place the default null value in c2 so a row in t1a might look like (c1_rowX, null, c3_rowX). Instead I get a type error because it's coping c2 (string type) data from t1 into c3 (int type) of t1a. the copy

Redshift - How to remove NOT NULL constraint?

喜你入骨 提交于 2019-12-21 07:01:52
问题 Since Redshift does not support ALTER COLUMN , I would like to know if it's possible to remove the NOT NULL constraints from columns in Redshift. 回答1: You cannot alter the table. There is an alternative approach. You can create a new column with NULL constraint. Copy the values from your old column to this new column and then drop the old column. Something like this: ALTER TABLE table1 ADD COLUMN somecolumn (definition as per your reqm); UPDATE table1 SET somecolumn = oldcolumn; ALTER TABLE

AWS Redshift - Add IDENTITY column to existing table

て烟熏妆下的殇ゞ 提交于 2019-12-21 04:51:22
问题 In AWS Redshift, when attempting to add an IDENTITY column to an existing table using the command ALTER TABLE table_name ADD COLUMN id bigint IDENTITY(1,1); I get the following error ERROR: ALTER TABLE ADD COLUMN does not support columns with type IDENTITY Which obviously implies that this simply isn't allowed in Redshift. Will I need to drop and recreate the table? Or is there some workaround solution to get this done in Redshift? 回答1: While you can't do it directly, you can accomplish this

AWS Redshift - Add IDENTITY column to existing table

一个人想着一个人 提交于 2019-12-21 04:51:03
问题 In AWS Redshift, when attempting to add an IDENTITY column to an existing table using the command ALTER TABLE table_name ADD COLUMN id bigint IDENTITY(1,1); I get the following error ERROR: ALTER TABLE ADD COLUMN does not support columns with type IDENTITY Which obviously implies that this simply isn't allowed in Redshift. Will I need to drop and recreate the table? Or is there some workaround solution to get this done in Redshift? 回答1: While you can't do it directly, you can accomplish this

How does Tableau run queries on Redshift? (And/or why can't Redshift display Tableau queries?)

♀尐吖头ヾ 提交于 2019-12-21 03:43:24
问题 I'm kicking tires on BI tools, including, of course, Tableau. Part of my evaluation includes correlating the SQL generated by the BI tool with my actions in the tool. Tableau has me mystified. My database has 2 billion things; however, no matter what I do in Tableau, the query Redshift reports as having been run is "Fetch 10000 in SQL_CURxyz", i.e. a cursor operation. In the screenshot below, you can see the cursor ids change, indicating new queries are being run -- but you don't see the

Show tables, describe tables equivalent in redshift

空扰寡人 提交于 2019-12-20 08:10:25
问题 I'm new to aws, can anyone tell me what are redshifts' equivalents to mysql commands? show tables -- redshift command describe table_name -- redshift command 回答1: All the information can be found in a PG_TABLE_DEF table, documentation. Listing all tables in a public schema (default) - show tables equivalent: SELECT DISTINCT tablename FROM pg_table_def WHERE schemaname = 'public' ORDER BY tablename; Description of all the columns from a table called table_name - describe table equivalent:

Show tables, describe tables equivalent in redshift

牧云@^-^@ 提交于 2019-12-20 08:10:10
问题 I'm new to aws, can anyone tell me what are redshifts' equivalents to mysql commands? show tables -- redshift command describe table_name -- redshift command 回答1: All the information can be found in a PG_TABLE_DEF table, documentation. Listing all tables in a public schema (default) - show tables equivalent: SELECT DISTINCT tablename FROM pg_table_def WHERE schemaname = 'public' ORDER BY tablename; Description of all the columns from a table called table_name - describe table equivalent:

[Amazon](500310) Invalid operation: This type of IN/NOT IN query is not supported yet;

自作多情 提交于 2019-12-20 05:47:21
问题 I'm converting this query from Netezza to run with my RedShift dw. I'm continuously getting this error. Amazon Invalid operation: This type of IN/NOT IN query is not supported yet; I have tried converting it using 'EXISTS/NOT EXISTS' condition but still not successful. Can someone give his/her input how should i convert that IN, NOT IN part? CREATE TEMP TABLE TMP_EMPLY_BRND AS ( Select EMPLY_SRRGT_ID, EMPLY_PRMRY_BRND_PRDCT_DPRTMNT_EFF_STRT_DT_KEY, EMPLY_PRMRY_PRDCT_DPRTMNT_GRP_SRRGT_ID, From

How to get substring for filter and group by clause in AWS Redshift database

a 夏天 提交于 2019-12-20 05:42:28
问题 How to get substring from column which contains records for filter and group by clause in AWS Redshift database. I have table with records like: Table_Id | Categories | Value <ID> | ABC1; ABC1-1; XYZ | 10 <ID> | ABC1; ABC1-2; XYZ | 15 <ID> | XYZ | 5 ..... Now I want to filter records based on individual category like 'ABC1' or 'ABC1 and XYZ' Expected output from query would like: Table_Id | Categories | Value <ID> | ABC1 | 25 <ID> | ABC1-1 | 10 <ID> | ABC1-2 | 15 <ID> | XYZ | 30 ..... So need