스파크
-
Databricks에서 Azure DataLake Storage Gen2 액세스하기Data 2022. 9. 2. 14:25
다음 3단계 스텝으로 진행하는 방법을 보여준다. Secret 스콥과 Secret을 생성한다. account 키를 사용하여 스파크 세션을 위한 설정을 한다. ADLS Gen3를 액세스한다. 먼저 keyr값을 이용하여 직접액세스하는 것을 보여준다. 먼저 애저의 storage account를 생성하고, 컨테이너를 하나 생성한다. 그리고 아래에서 account key를 이용하여 databricks에서 액세스 할것이기 때문에 키를 복사한다. 데이터브릭스에서 demoCluster 생성 : 14일 무료버전 사용중이고, 데모클러스터는 적당히 생성하였음. 노트북 생성 spark 세션을 구성한다. spark.conf.set("fs.azure.account.key.스토리지어카운트.dfs.core.windows.net","위..
-
Spark 3.2 & 3.3 Released[스파크 3.2]Data 2022. 8. 9. 16:58
스파크 3.2가 출시 되면서 스파크기반의 판다스를 사용할수 있게 되었다. 실로 파이썬 개발자에게는 터닝포인트다. 이전에 데이터처리를 판다스로 하면 싱글노드를 사용할수 밖에 없었다. 이제는 판다스를 사용하면서 분산처리가 가능하게 되었다. 이제 더이상 스파크 API를 사용하지 않아도 되는것인가? 1G이상의 빅데이터를 로딩하기위하여 아래와 같이 사용한다. spdf = spark.read.load('*.csv', format='csv', header=True) 로딩한 데이터를 스파크 기반의 판다스 데이터프레임으로 변경한다. df = spdf.to_pandas_on_spark() 이제 80%이상의 호환성으로 판다스 API를 사용하면된다. 대단한일인듯하다. https://spark.apache.org/docs/la..