amazon-redshift

Extracting Time from Timestamp in SQL

て烟熏妆下的殇ゞ 提交于 2019-12-25 18:02:13
问题 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:08
问题 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,

How do I connect to my Amazon RedShift cluster using Python?

元气小坏坏 提交于 2019-12-25 16:10:51
问题 I have the ODBC url to my Amazon RedShift cluster. I wrote a simple Python script to connect to the cluster, however the connection keeps failing. I have tried the following connection strings; 1) 'Driver={SQL Server}; Server=$SERVER; Database=$DB; UID=$UID; PWD=$PWD; Port=5439' ERROR - 'pyodbc.Error: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. (17) (SQLDriverConnect); [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB

Amazon 500150 : Unable to connect to Redshift Cluster

ⅰ亾dé卋堺 提交于 2019-12-25 11:58:29
问题 I followed all the steps mentioned on here to connect to Redshift through Workbench J . I am not using SSH to connect, so have left SSH settings alone. When I select Security after selecting Redshift , I see : Your account does not support the EC2-Classic Platform in this region. Cluster Security Groups are only available when the EC2-Classic Platform is supported. Instead, use VPC Security Groups to control access to your clusters. Go to the EC2 Console to view your VPC Security Groups. For

Can I connect Kibana with Amazon Redshift?

≡放荡痞女 提交于 2019-12-25 08:49:33
问题 I am having a difficulty connecting Kibana with Amazon Redshift. Is there a way to connect Kibana without Elasticsearch? Is there a way to directly connect Kibana with Amazon Redshift for visualisation? 回答1: No. You have to ingest the data in elastic from beat/ logstash and then use kibana for the visualization. 回答2: No. Kibana only works with Elasticsearch. 来源: https://stackoverflow.com/questions/44757274/can-i-connect-kibana-with-amazon-redshift

expand a JSON data into new columns in a generic fashion in Redshift

纵饮孤独 提交于 2019-12-25 05:20:26
问题 I have a DB table like SomeSchema ID Params 1234 {'normalized_CR': 1.111434628975265, 'Rating': 0.0, Rank': 1410} 1235 {'normalized_CR': 1.123142131, 'Rating': 1.0, Rank': 210} How can I expand this data into individual columns by same name in Redshift? I am googling online, but get results mostly for json_extract_path which can get only one key. 回答1: After much googling, turns out that there is no simple way to do this as of now, and the brute force way is the way ahead. Also, the data above

Dist and Sort Keys Redshift

烈酒焚心 提交于 2019-12-25 04:27:45
问题 I'm trying to add dist and sort keys to some of the tables in redshift. I notice that before adding the size of the table is 0.50 and after adding it gets increased to 0.51 or 0.52. Is this possible ? The whole purpose of having dist and sort keys is to decrease the size of the table and help in increasing the read/write performance. 回答1: That is not the purpose of having a DISTKEY and SORTKEY . To decrease the storage size of a table, use compression . The DISTKEY is used to distribute data

Pull data from Redshift

独自空忆成欢 提交于 2019-12-25 04:27:30
问题 We want to pull data from Redshift database into SQL Server. Currently, we are using SQL Workbench to analyze Redshift database. We referred the following link - Connect Your Cluster By using SQL Workbench Here we used - RedshiftJDBC41-1.1.17.1017 driver to connect. Now we want to push this data to DWH in SQL Server 2016. So what is the best way to accomplish this? There is not much information on net on how to pull data from Redshift. Can we have SSIS component or something in SSDT/SSIS2015

How can I write this postgres query in Amazon redshift such that it is as optimized as it was in postgres?

冷暖自知 提交于 2019-12-25 03:54:25
问题 Here is my original query that I was using in postgres - SELECT a.id, (SELECT val FROM database.detail x WHERE name = 'blablah' AND x.id = b.id) AS myGroup, c.username, a.someCode, a.timeTaken, a.date ::timestamp WITH time ZONE AT time ZONE 'PST' AS date, SUM (CASE WHEN (b.name = 'name1') THEN b.val ::INTEGER ELSE 0 END ) AS name11, SUM (CASE WHEN (b.name = 'name2') THEN b.val ::INTEGER ELSE 0 END ) AS name12 FROM database.myTable a, database.detail b, database.client c WHERE a.id = b.id AND

Join table to a subquery

ぃ、小莉子 提交于 2019-12-25 03:22:53
问题 In a previous post someone helped me with a subquery. Now I'd like to add to the query but am getting an error message. (I'm still learning rules around subqueries.) Updated SQL below. The error is: [Amazon](500310) Invalid operation: invalid reference to FROM-clause entry for table "application_stages"; SELECT t1.*, applications.status, applications.stage_name FROM application_stages t1 JOIN ( select application_id, max(exited_on) as exited_on from application_stages group by application_id