Redshift

redshift - how to insert into table generated time series

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to generate time series in Redshift and insert into table, but no luck. What I have tried so far: insert into date(dateid,date) SELECT to_char(datum, 'YYYYMMDD')::int AS dateid, datum::date AS date FROM ( select '1970-01-01'::date + generate_series(0, 20000) as datum ) tbl; Getting the following error SQL Error [500310] [0A000]: [Amazon](500310) Invalid operation: Specified types or functions (one per INFO message) not supported on Redshift tables.; Any ideas or workaround ? 回答1: The issue is that generate_series() can be run on

AWS Glue ETL job from AWS Redshift to S3 fails

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying out AWS Glue service to ETL some data from redshift to S3. Crawler runs successfully and creates the meta table in data catalog, however when I run the ETL job ( generated by AWS ) it fails after around 20 minutes saying "Resource unavailable". I cannot see AWS glue logs or error logs created in Cloudwatch. When I try to view them it says "Log stream not found. The log stream jr_xxxxxxxxxx could not be found. Check if it was correctly created and retry." I would appreciate it if you could provide any guidance to resolve this

AWS Lambda times out connecting to RedShift

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My Redshift cluster is in a private VPC. I've written the following AWS Lamba in Node.js which should connect to Redshift (dressed down for this question): 'use strict'; console.log('Loading function'); const pg = require('pg'); exports.handler = (event, context, callback) => { var client = new pg.Client({ user: 'myuser', database: 'mydatabase', password: 'mypassword', port: 5439, host: 'myhost.eu-west-1.redshift.amazonaws.com' }); // connect to our database console.log('Connecting...'); client.connect(function (err) { if (err) throw err;

Upsert from AWS Glue to Amazon Redshift

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I understand that there is no direct UPSERT query one can perform directly from Glue to Redshift. Is it possible to implement the staging table concept within the glue script itself? So my expectation is creating the staging table, merging it with destination table and finally deleting it. Can it be achieved within the Glue script? 回答1: Yes, it can be totally achievable. All you would need is to import pg8000 module into your glue job. pg8000 module is the python library which is used to make connection with Amazon Redshift and execute SQL

AWS Glue to Redshift: duplicate data?

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here are some bullet points in terms of how I have things setup: I have CSV files uploaded to S3 and a Glue crawler setup to create the table and schema. I have a Glue job setup that writes the data from the Glue table to our Amazon Redshift database using a JDBC connection. The Job also is in charge of mapping the columns and creating the redshift table. By re-running a job, I am getting duplicate rows in redshift (as expected). However, is there way to replace or delete rows before inserting the new data? BOOKMARK functionality is Enable

Redshift Python encrypt/decrypt UDF Error - String contains invalid or unsupported UTF8 codepoints

匿名 (未验证) 提交于 2019-12-03 01:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to create the below encrypt and decrypt UDF's in Redshift. Library: create library pyaes language plpythonu from 's3://aws_python/library/pyaes/pyaes.zip' credentials 'aws-role' region as 'aws-region'; Encrypt: CREATE OR REPLACE FUNCTION test.aes_encrypt(input varchar(max)) RETURNS varchar(max) AS ' if input is None: return None import pyaes key = ''abcdefghijklopoo'' aes = pyaes.AESModeOfOperationCTR(key) encrypted_msg = aes.encrypt(input) return encrypted_msg ' LANGUAGE plpythonu STABLE; Tried with below options as well: encrypted

ubuntu安装redshift之后使用

匿名 (未验证) 提交于 2019-12-03 00:22:01
sudo apt-get install redshift 装完后,设置参数两种方法: 一:(需要开窗口输入命令,占一个执行窗口) redshift-gtk -l 39.92:116.46 -t 5500:4500即可。 这条命令的意思是手动将经纬度设定在’39.92:116.46’(北京),并且调整白天色温为 5500K,夜晚 4500K, 二:(配置好就一直在后台执行) 在 ~/.config 目录中建立文件 redshift.conf 输入以下内容 [redshift] ; 白天屏幕温度 temp-day= 3500 ; 夜晚屏幕温度 temp-night=3500 ; 昼夜是否平滑过度(1/0) transition=1 ; 位置提供方式(redshift -l list) location-provider=manual [manual] ; 位置提供方式设置 ; 经纬度(深圳) lat=22.5410800000 lon=113.9394000000 文章来源: ubuntu安装redshift之后使用

Amazon Redshift 中的数据保护

半腔热情 提交于 2019-11-30 18:54:49
应该是只有S3和Redshift可以在使用途中启用加密选项,其他服务如EC2、RDS启动加密都必须是在创建时启用,否则需要数据导入导出操作。 您可以使用 AWS 管理的密钥或客户管理的密钥 (CMK) 修改未加密的集群以使用 AWS Key Management Service (AWS KMS) 加密。 当您修改集群以启用 KMS 加密时,Amazon Redshift 会自动将您的数据迁移到新加密的集群 。您还可以通过修改集群将未加密的集群迁移到加密的集群。 在迁移操作过程中,您的集群处于只读模式,集群状态显示为 正在调整大小 。 使用 CLI 更改集群加密 要修改未加密的集群以使用 KMS,请运行 modify-cluster CLI 命令并指定 –-encrypted ,如下所示。默认情况下,使用您的默认 KMS 密钥。要指定客户管理的密钥,请包括 --kms-key-id 选项。 aws redshift modify-cluster --cluster-identifier <value> --encrypted --kms-key-id <value> 要从您的集群中删除加密,请运行以下 CLI 命令。 aws redshift modify-cluster --cluster-identifier <value> --no-encrypted 来源: https:/

Amazon Redshift Spectrum

倾然丶 夕夏残阳落幕 提交于 2019-11-30 18:39:45
Amazon Redshift Spectrum 驻留在独立于您的集群的专用 Amazon Redshift 服务器上。 Redshift Spectrum 将很多计算密集型任务 (如谓词筛选和聚合) 下推到 Redshift Spectrum 层。因此,Redshift Spectrum 查询使用的集群处理容量比其他查询的少得多。Redshift Spectrum 还可智能地扩展。基于您的查询的需求,Redshift Spectrum 可能能够使用数千个实例来利用大规模并行处理。 您通过定义您的文件的结构并将文件作为外部数据目录中的表注册来创建 Redshift Spectrum 表。外部数据目录可以是 AWS Glue、Amazon Athena 附带的数据目录或您自己的 Apache Hive 元存储。您可使用数据定义语言 (DDL) 命令或使用连接到外部数据目录的任何其他工具从 Amazon Redshift 创建和管理外部表。对外部数据目录进行的更改将立即对您的任何 Amazon Redshift 集群可用。 您也可在一个或多个列上为外部表分区。将分区定义为外部表的一部分可提升性能。改进的原因是 Amazon Redshift 查询优化程序消除了不含所查询数据的分区。 在定义 Redshift Spectrum 表之后,您可以像查询和联接任何其他 Amazon

Amazon Redshift 基于 PostgreSQL 8.0.2

[亡魂溺海] 提交于 2019-11-30 18:38:31
Amazon Redshift 基于 PostgreSQL 8.0.2。Amazon Redshift 和 PostgreSQL 之间的差别非常大,您在设计和开发数据仓库应用程序时必须注意这一点。 Amazon Redshift 是专为联机分析处理 (OLAP) 和业务智能 (BI) 应用程序设计的,这些应用程序需要针对大型数据集的复杂查询。 由于它解决了迥然不同的需求,因此 Amazon Redshift 使用的专用数据存储 schema 和 查询执行引擎完全不同于 PostgreSQL 实现 。例如,联机事务处理 (OLTP) 应用程序通常将数据存储在行中,而 Amazon Redshift 将数据存储在列中 ,并使用专业的数据压缩编码以获得最优的内存使用和磁盘 I/O。此外,为了改进性能,删除了一些适合小型 OLTP 处理的 PostgreSQL 功能(如辅助索引和高效单行数据操作运算)。 实现方式不同的功能 许多 Amazon Redshift SQL 语言元素都具有不同的性能特征和使用语法以及语义,并且等效的 PostgreSQL 实施有很大不同。 重要 请勿假设 Amazon Redshift 和 PostgreSQL 共同具有的元素的语义是相同的。确保查阅 Amazon Redshift 开发人员指南 SQL 命令 以了解常有的细小差异。 一个具体的示例是