일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Redshift
- matplotlib
- dataframe
- Google Spreadsheet
- Google Excel
- hive
- gas
- Tkinter
- math
- 파이썬
- list
- Mac
- GIT
- Python
- PANDAS
- c#
- google apps script
- Java
- PostgreSQL
- Apache
- Excel
- string
- Kotlin
- numpy
- SQL
- array
- django
- PySpark
- Github
- Today
- Total
목록hive (43)
달나라 노트
Hive에선 collect_list, collect_set이라는 함수를 제공합니다. 이는 여러 행의 데이터를 합칠 때 사용합니다. 마치 Redshift의 listagg와 비슷한 함수라고 생각하면 되겠네요. Table name = employees department_no join_dt name 10 2020-02-01 Bero 10 2020-02-02 Alice 10 2020-02-03 Alice 20 2020-02-03 Dave 20 2020-02-02 Hella 20 2020-02-04 Alice 30 2020-02-06 Grace 30 2020-02-04 Irene 30 2020-02-05 Hella 위와 같은 table이 있다고 가정해봅시다. selectdepartment_no , collect_..
from pyhive import hive def query_execute_hive(query, result_cols): hive_connection = hive.Connection( host='host_name_url', port=10000 # port_number, username='hive_user_id', password='hive_user_password', database='default', auth='LDAP' ) cursor = hive_connection.cursor() raw_query_list = query.split(';\n') raw_query_list = [str(x).strip() for x in raw_query_list] raw_query_list = list(filter(..
truncate table talbe_name; 위 구문은 table_name이라는 이름의 테이블 속 데이터를 모두 삭제합니다. (table 속 데이터만 없어지는 것이고 table 자체와 해당 table에 존재했던 컬럼들은 보존됩니다.)
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..