일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- Redshift
- Python
- string
- dataframe
- numpy
- Tkinter
- Java
- PostgreSQL
- c#
- Google Excel
- hive
- Kotlin
- Mac
- array
- 파이썬
- gas
- Apache
- matplotlib
- GIT
- PANDAS
- Google Spreadsheet
- google apps script
- list
- Excel
- math
- django
- Github
- SQL
- PySpark
- Today
- Total
목록Redshift (69)
달나라 노트
Redshift -> S3 -- Redshift -> S3 unload(' ----- (S3 server에 올릴 data를 추출하는 query) select col1 , col2 from test_table_1 -- where col3 in (''valid'') ----- (쿼리 전체가 따옴표로 감싸져있기 때문에 쿼리 내부의 문자는 따옴표 2개로 string을 감싸야함.) ') to 's3://root_dir/test_dir/' ----- (unload 속에 적힌 query 결과가 저장될 s3 server의 경로) iam_role 'credentials' ----- (s3 server에 로그인하기 위한 credential) csv ----- (csv format으로 저장) delimiter ',' ---..
GREATEST Syntax GREATEST(exp1, exp2, ...) GREATEST 함수는 여러 exp중 가장 큰 값을 return합니다. exp는 column name일 수도 있고 특정 값일수도 있습니다. table name = products product_no category_no price 1250 10 10000 3028 10 8000 2075 10 7000 5217 10 12000 4203 20 11000 3356 20 5500 2103 20 3030 4301 20 6040 8043 30 1010 3356 30 5500 9034 30 9040 1234 30 6500 SELECT product_no, category_no, price, GREATEST(price, 5000) AS temp..
- S3를 이용하는 구문들에 대한 설명은 아래 링크 참조 S3 server에 data 올리기 (csv format) = https://cosmosproject.tistory.com/176 Redshift : unload & copy (s3 서버에 query 결과 upload하기, s3서버에서 파일 불러와 database table 만들기. CSV redshift의 unload 구문은 query결과를 s3 서버에 파일의 형식으로 업로드할 수 있게 해줍니다. copy 구문은 반대로 s3 서버에 있는 파일을 불러와 database 내의 table로 만들 수 있도록 해줍니다. 예시를 보 cosmosproject.tistory.com 이번에는 parquet format을 이용해서 Redshift, Hive등의 d..
date_add(datepart, interval_value, date/time/timestamp) date_add 함수는 위처럼 사용할 수 있습니다. datepart = 날짜 연산을 할 날짜 단위(e.g. day, week, month, year ...) interval_value = 날짜 연산을 할 시간의 양 date/time/timestamp = 기준 날짜 select current_date; --> 2021-02-22 select date_add('day', 10, current_date); --> 2021-03-04 00:00:00.000000 select date_add('week', 2, current_date); --> 2021-03-08 00:00:00.000000 select date_..