amazon-redshift

postgresql - view schema privileges

二次信任 提交于 2020-06-22 06:43:08
问题 Is there a query I can run to show currently assigned privileges on a particular schema? i.e. privileges that were assigned like so: GRANT USAGE ON SCHEMA dbo TO MyUser I have tried SELECT * FROM information_schema.usage_privileges; but this only returns grants to the built-in PUBLIC role. Instead, I want to see which users have been granted privileges on the various schema. Note: I'm actually using Amazon Redshift rather than pure PostgreSQL, although I will accept a pure PostgreSQL answer

postgresql - view schema privileges

拜拜、爱过 提交于 2020-06-22 06:42:18
问题 Is there a query I can run to show currently assigned privileges on a particular schema? i.e. privileges that were assigned like so: GRANT USAGE ON SCHEMA dbo TO MyUser I have tried SELECT * FROM information_schema.usage_privileges; but this only returns grants to the built-in PUBLIC role. Instead, I want to see which users have been granted privileges on the various schema. Note: I'm actually using Amazon Redshift rather than pure PostgreSQL, although I will accept a pure PostgreSQL answer

How to fetch records using vertical columns in Amazon Redshift

大城市里の小女人 提交于 2020-05-16 03:49:26
问题 I need to fetch records between the date range given in two columns. My Table structure is like: CREATE TABLE shared ( id integer NOT NULL, product varchar(50) NOT NULL, parent_id integer NOT NULL, key_code varchar(100) NOT NULL, key_value varchar(8000) ); INSERT INTO shared (`id`, `product`, `parent_id`, 'key_code', 'key_value') VALUES (1, 'a',1, 'start_date','1/7/2011'), (2, 'a', 1,'end_date','15/7/2011'), (3, 'a',1, 'type','Promotion'), (4, 'a',1,'plan', 'new'), (5, 'a',5, 'start_date','11

Get average of last 7 days

自作多情 提交于 2020-05-14 10:31:30
问题 I'm attacking a problem, where I have a value for a a range of dates. I would like to consolidate the rows in my table by averaging them and reassigning the date column to be relative to the last 7 days. My SQL experience is lacking and could use some help. Thanks for giving this a look!! E.g. 7 rows with dates and values. UniqueId Date Value ........ .... ..... a 2014-03-20 2 a 2014-03-21 2 a 2014-03-22 3 a 2014-03-23 5 a 2014-03-24 1 a 2014-03-25 0 a 2014-03-26 1 Resulting row UniqueId Date

Get average of last 7 days

女生的网名这么多〃 提交于 2020-05-14 10:30:09
问题 I'm attacking a problem, where I have a value for a a range of dates. I would like to consolidate the rows in my table by averaging them and reassigning the date column to be relative to the last 7 days. My SQL experience is lacking and could use some help. Thanks for giving this a look!! E.g. 7 rows with dates and values. UniqueId Date Value ........ .... ..... a 2014-03-20 2 a 2014-03-21 2 a 2014-03-22 3 a 2014-03-23 5 a 2014-03-24 1 a 2014-03-25 0 a 2014-03-26 1 Resulting row UniqueId Date

Get average of last 7 days

旧街凉风 提交于 2020-05-14 10:28:28
问题 I'm attacking a problem, where I have a value for a a range of dates. I would like to consolidate the rows in my table by averaging them and reassigning the date column to be relative to the last 7 days. My SQL experience is lacking and could use some help. Thanks for giving this a look!! E.g. 7 rows with dates and values. UniqueId Date Value ........ .... ..... a 2014-03-20 2 a 2014-03-21 2 a 2014-03-22 3 a 2014-03-23 5 a 2014-03-24 1 a 2014-03-25 0 a 2014-03-26 1 Resulting row UniqueId Date

Stream data from S3 bucket to redshift periodically

与世无争的帅哥 提交于 2020-04-30 07:34:22
问题 I have some data stored in S3 . I need to clone/copy this data periodically from S3 to Redshift cluster. To do bulk copy , I can use copy command to copy from S3 to redshift. Similarly is there any trivial way to copy data from S3 to Redshift periodically . Thanks 回答1: Try using AWS Data Pipeline which has various templates for moving data from one AWS service to other. The "Load data from S3 into Redshift" template copies data from an Amazon S3 folder into a Redshift table. You can load the

splitting rows in Redshift

ⅰ亾dé卋堺 提交于 2020-03-16 06:48:18
问题 In my table the data is as below: col1 col2 col3 col4 A1 A2 A3 4 B1 B2 B3 3 C1 C2 C3 1 I need the output as below: col1 col2 col3 col4 A1 A2 A3 1 A1 A2 A3 2 A1 A2 A3 3 A1 A2 A3 4 B1 B2 B3 1 B1 B2 B3 2 B1 B2 B3 3 C1 C2 C3 1 Im using Redshift DB. 回答1: You're correct, Redshift currently doesn't support generate_series. One way to get around this is to generate your own series table and join to that. In my example below I just did a row_number() against the pg_attribute table to generate the

splitting rows in Redshift

寵の児 提交于 2020-03-16 06:48:04
问题 In my table the data is as below: col1 col2 col3 col4 A1 A2 A3 4 B1 B2 B3 3 C1 C2 C3 1 I need the output as below: col1 col2 col3 col4 A1 A2 A3 1 A1 A2 A3 2 A1 A2 A3 3 A1 A2 A3 4 B1 B2 B3 1 B1 B2 B3 2 B1 B2 B3 3 C1 C2 C3 1 Im using Redshift DB. 回答1: You're correct, Redshift currently doesn't support generate_series. One way to get around this is to generate your own series table and join to that. In my example below I just did a row_number() against the pg_attribute table to generate the

How to grant usage on all schemas in Redshift?

守給你的承諾、 提交于 2020-03-05 06:05:54
问题 I want to create a read only user which should have SELECT access to all tables in all schemas. I checked the redshift documentation but it looks like we can only grant access to a specific schema in a single sql statement. (not all schemas at once This read only user should have read only access to all tables/schemas that will be created in future. I am not sure how to do that. Am I missing something or this is done on purpose by AWS? If this is a limitation then what is the possible