일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- numpy
- 파이썬
- Kotlin
- array
- gas
- PySpark
- Redshift
- Python
- Java
- string
- Google Excel
- Mac
- PANDAS
- matplotlib
- Google Spreadsheet
- hive
- math
- Apache
- Excel
- Github
- list
- GIT
- c#
- SQL
- PostgreSQL
- dataframe
- google apps script
- django
- Tkinter
- Today
- Total
목록Redshift (76)
달나라 노트
table을 생성하고 insert into로 데이터를 insert하거나 update를 할 때 아래와 같은 에러가 발생할 수 있습니다. values too long for type character varying 위 에러는 table에 있는 column의 최대 길이보다 insert 또는 update할 값의 길이가 더 길어서 값을 담지 못할 때 발생합니다. 이런 경우 alter table, alter column을 이용하여 column의 최대 길이를 늘려주면 됩니다. Syntax는 아래와 같습니다. alter table table_name alter column column_name type data_type ; alter table main.items alter column item_name type va..
delete from syntax delete from table_name where condition; table_name이라는 table에서 명시한 condition이 True인 행(row)들을 삭제합니다. delete from test_table where dy > 20201110; 위처럼 적게되면 test_table에 있는 dy컬럼의 데이터가 20201120보다 큰 값을 가진 행(row)을 모두 삭제하게됩니다. delete from test_table; 만약 조건을 명시하지 않는다면 해당 테이블의 모든 데이터가 지워집니다.(단, 테이블은 그대로 남아있습니다.) insert into syntax insert into table_name values (value1, value2, ...) ; inse..
date_part 함수를 사용하면 날짜 데이터에서 특정 부분을 추출해낼 수 있습니다. date_part 함수의 syntax는 아래와 같습니다. date_part(part, date/timestamp) date/teimstamp 데이터에서 part에 명시된 부분을 return합니다. -- 현재 sysdate = 2021-06-07 20:35:59.461359 select date_part('year', sysdate); --> 2021 select date_part('month', sysdate); --> 6 select date_part('day', sysdate); --> 7 select date_part('week', sysdate); --> 23 select date_part('hour', sysd..
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 ',' ---..