sql
-
[psycopg2] postgresql oid 에 대한 텍스트 가져오는 쿼리Programming Language/Python 2021. 11. 15. 18:05
postgresql 에는 oid (object identifier) 가 있는데 테이블의 타입도 oid 로 관리하고 있다. 만약 python 에서 psycopg2 라이브러리를 사용한다면, 아래처럼 타입을 oid 로 받게 된다. import psycopg2 conn = psycopg2.connect() cur = conn.cursor() cur.execute("select A, B from TEST") cur.description # (Column(name='A', type_code=20), Column(name='B', type_code=25)) 이때, 해당 oid 에 대한 타입명을 알고 싶으면 아래 쿼리를 사용하면 알 수 있다. # psql select 20::regtype::text; text ----..
-
[Spark] The case sensitive option of sparkOpen Source/Spark 2020. 10. 21. 12:56
Used spark version: 2.4.4 The column of spark DataFrame can be selected regardless of case. Because the spark uses case-sensitive option (spark.sql.caseSensitive : default is False). 1. Example of case-sensitive option is False (default) You can select columns ignoring the case of column name. df = spark.createDataFrame([{'ABC': 1, 'abc': 2}]) df.show() ''' output: +---+---+ |ABC|abc| +---+---+ ..