amazon-redshift

Load data into Redshift using Node.js

三世轮回 提交于 2020-01-01 11:37:27
问题 What are some ways of inserting data into Amazon Redshift using node.js? This should be pretty straightforward, but I was unable to find any concrete example for efficient loading. 回答1: One way of doing that would be to load the data into S3 using AWS node.js SDK (there's an example in the documentation), then use node-pg to COPY the data into Redshift : var pg = require('pg'); var conString = "postgres://user:password@db-endpoint:port/schema"; var client = new pg.Client(conString); client

Amazon Redshift: Selecting columns based on a list of columns present in a table

烂漫一生 提交于 2019-12-31 05:21:29
问题 Is it possible in any way (without scripting) to aggregate columns which are stored in a table cell. Basically what i am trying to achieve here is that if i have the following table Table 1 KEYNAME | COLUMN_NAME COUNT_USER | USER_ID SUM_HOURS | HOURS_WATCHED Can i do something like select SUM((select column_name from TABLE1 where KEYNAME = "SUM_HOURS")) FROM MAIN_TABLE I have the option to script in python via which i know how to achieve this. But i am curious to know if this is possible in

Scheduling data extraction from AWS Redshift to S3

匆匆过客 提交于 2019-12-31 01:49:34
问题 I am trying to build out a job for extracting data from Redshift and write the same data to S3 buckets. Till now I have explored AWS Glue, but Glue is not capable to run custom sql's on redshift. I know we can run unload commands and can be stored to S3 directly. I am looking for a solution which can be parameterised and scheduled in AWS. 回答1: Consider using AWS Data Pipeline for this. AWS Data Pipeline is AWS service that allows you to define and schedule regular jobs. These jobs are

Spark Redshift with Python

我的梦境 提交于 2019-12-30 07:30:49
问题 I'm trying to connect Spark with amazon Redshift but i'm getting this error : My code is as follow : from pyspark.sql import SQLContext from pyspark import SparkContext sc = SparkContext(appName="Connect Spark with Redshift") sql_context = SQLContext(sc) sc._jsc.hadoopConfiguration().set("fs.s3n.awsAccessKeyId", <ACCESSID>) sc._jsc.hadoopConfiguration().set("fs.s3n.awsSecretAccessKey", <ACCESSKEY>) df = sql_context.read \ .option("url", "jdbc:redshift://example.coyf2i236wts.eu-central- 1

How to find out what are the privileges granted to one group in redshift

本秂侑毒 提交于 2019-12-30 07:20:34
问题 Team, I am using amazon redshift (8.0.2 version ) I have created one group and given below 2 permission, and added one user to that group. If i check 'pg_group', i will be able to see the user name who are members of this group. But i should be able to see what are the permissons granted to that group. for e.g. redshift=# create group group1; CREATE GROUP redshift=# grant select on public.table_mar19_test2 to group group1; GRANT redshift=# alter group group1 add user user001; ALTER GROUP

AWS DynamoDB Stream into Redshift

末鹿安然 提交于 2019-12-29 08:09:11
问题 We would like to move data from DynamoDB NoSQL into Redshift Database continously as a stream. I am having hard time understand all the new terms/technologies in AWS. There is 1) DynamoDB Streams 2) AWS Lambda 3) AWS Kinesis Firehose Can someone provide a brief summary of each. What are DynamoDB streams? How does this differ from AmazonKinesis? After reading all the resources, this is my hypothesis understanding, please verify below. (a) I assume DynamoDB Streams, create the streaming data of

generate_series for every hour in hh24:mi:ss format

回眸只為那壹抹淺笑 提交于 2019-12-26 23:31:43
问题 i have a generate series of every minute for the whole 24 hours. how about a generate _series showing every hour only in hh24:mi:ss and hh24:mi format. result should be 00:00 01:00 02:00 : : 23:00 回答1: This query: SELECT to_char(generate_series(0, 23) * interval '1 hour' + '2019-01-01 00:00:00'::timestamp, 'HH24:MI') will return: 00:00 01:00 02:00 03:00 ... 23:00 Just modify the format string for what you desire. 来源: https://stackoverflow.com/questions/57150250/generate-series-for-every-hour

generate_series for every hour in hh24:mi:ss format

倖福魔咒の 提交于 2019-12-26 23:28:28
问题 i have a generate series of every minute for the whole 24 hours. how about a generate _series showing every hour only in hh24:mi:ss and hh24:mi format. result should be 00:00 01:00 02:00 : : 23:00 回答1: This query: SELECT to_char(generate_series(0, 23) * interval '1 hour' + '2019-01-01 00:00:00'::timestamp, 'HH24:MI') will return: 00:00 01:00 02:00 03:00 ... 23:00 Just modify the format string for what you desire. 来源: https://stackoverflow.com/questions/57150250/generate-series-for-every-hour

Extracting Time from Timestamp in SQL

烈酒焚心 提交于 2019-12-25 18:02:59
问题 I am using Redshift and am looking to extract the time from the timestamp. Here is the timestamp: 2017-10-31 23:30:00 and I would just like to get the time as 23:30:00 Is that possible? 回答1: In Redshift you can simply cast the value to a time : the_timestamp_column::time alternatively you can use the standard cast() operator: cast(the_timestamp_column as time) 回答2: Please go through this link http://docs.aws.amazon.com/redshift/latest/dg/r_Dateparts_for_datetime_functions.html timezone,

Extracting Time from Timestamp in SQL

落花浮王杯 提交于 2019-12-25 18:02:57
问题 I am using Redshift and am looking to extract the time from the timestamp. Here is the timestamp: 2017-10-31 23:30:00 and I would just like to get the time as 23:30:00 Is that possible? 回答1: In Redshift you can simply cast the value to a time : the_timestamp_column::time alternatively you can use the standard cast() operator: cast(the_timestamp_column as time) 回答2: Please go through this link http://docs.aws.amazon.com/redshift/latest/dg/r_Dateparts_for_datetime_functions.html timezone,