da-analysis / asac_5_dataanalysis

ASAC 5기 Data Analysis Project (google map recommendation system)
0 stars 1 forks source link

review/meta 데이터 브론즈 테이블로 생성 #16

Open syleeie2310 opened 3 months ago

syleeie2310 commented 3 months ago

review/meta 데이터 브론즈 테이블로 생성 -> hive_metastore

본인 로컬에서 받은 다음에 (혹은 colab > wget)으로 받은 다음에 데이터를 업로드 하기 1) drive 업로드 해주시고 저한테 말씀해주시면 2) 그냥 제가 AWS S3로 올릴게요 3) s3 file 아래 노트북 형태처럼 ㄴ dbfs:/data/raw/review/review-Hawaii.json.gz ㄴ 읽을 때 파일로 읽어서 region(컬럼)으로 만들어주기 (예를 들면 위에는 region Hawail) ㄴ 위 데이터를 모두 union 해서 하나로 합치기 https://tacademykr-asacanalysis.cloud.databricks.com/?o=3001521127938963#notebook/3210904128600493/command/3210904128600497 4) 합친 데이터를 hive_metastore에 저장하기 ㄴ da_cluster 로 작업

리뷰, 메타 둘다 해주기

soojeonglim commented 3 months ago

모든 지역 데이터들 drive에 업로드 완료했습니다! AWS S3에 업로드 부탁드립니다.

syleeie2310 commented 3 months ago

@soojeonglim 님 제가 AWS 업로드 하는건 퇴근하고 집에서 해야 될듯 해서, 이따가 집가서 올릴게요!

syleeie2310 commented 3 months ago

image

메타 데이터는 업로드 완료했어요 (/data/raw/metadata/) Catalog 들어가서 DBFS 가면 확인할 수 있고, file path 잘 찾으셔서 작업해주심 됩니다.

Spark API Format (파일명만 보고 바꾸심 됩니다) dbfs:/data/raw/metadata/meta-Alabama.json.gz File API Format /dbfs/data/raw/metadata/meta-Alabama.json.gz

위 API 형태이고, 리뷰 데이터는 조금 커서 받고 있는데 완료되면 스레드 남겨둘게요.

soojeonglim commented 3 months ago

넵! 감사합니다!!

syleeie2310 commented 3 months ago

image 리뷰 데이터는 dbfs:/data/raw/review 데이터 업로드 중입니다. 참고!

syleeie2310 commented 3 months ago

모두 업로드 되었는데 혹시 빠진 파일 없는지 체크해주시고 있으면 코멘트 달아주세요!! ㅎㅎ

soojeonglim commented 3 months ago

Error in callback <bound method UserNamespaceCommandHook.post_run_cell of <dbruntime.DatasetInfo.UserNamespaceCommandHook object at 0xffff821114e0>> (for post_run_cell): [INSUFFICIENT_PERMISSIONS] Insufficient privileges: User does not have permission SELECT on any file. SQLSTATE: 42501 File /databricks/python_shell/dbruntime/DatasetInfo.py:22, in UserNamespaceCommandHook.post_run_cell(self, result) 21 def post_run_cell(self, result): ---> 22 new_dataframe_info = self.user_ns.get_new_dataframe_infos_json() 23 if new_dataframe_info: 24 data = {"application/vnd.databricks.v1+datasetInfo": new_dataframe_info} File /databricks/python_shell/dbruntime/DatasetInfo.py:135, in UserNamespaceDict.get_new_dataframe_infos_json(self) 130 else: 131 continue 133 dataframe_info_json_fields = [ 134 '"name": %s' % json.dumps(df_name), --> 135 '"schema": %s' % df.schema.json(), 136 '"typeStr": %s' % json.dumps(typeStr), 137 ] 138 if delta_path: 139 dataframe_info_json_fields.append('"tableIdentifier": %s' % json.dumps(delta_path)) File /databricks/spark/python/pyspark/sql/connect/dataframe.py:1887, in DataFrame.schema(self) 1885 if self._cached_schema is None: 1886 query = self._plan.to_proto(self._session.client) -> 1887 self._cached_schema = self._session.client.schema(query) 1888 return copy.deepcopy(self._cached_schema) File /databricks/spark/python/pyspark/sql/connect/client/core.py:1172, in SparkConnectClient.schema(self, plan) 1168 """ 1169 Return schema for given plan. 1170 """ 1171 logger.info(f"Schema for plan: {self._proto_to_string(plan)}") -> 1172 schema = self._analyze(method="schema", plan=plan).schema 1173 assert schema is not None 1174 # Server side should populate the struct field which is the schema. File /databricks/spark/python/pyspark/sql/connect/client/core.py:1437, in SparkConnectClient._analyze(self, method, **kwargs) 1435 raise SparkConnectException("Invalid state during retry exception handling.") 1436 except Exception as error: -> 1437 self._handle_error(error) File /databricks/spark/python/pyspark/sql/connect/client/core.py:1910, in SparkConnectClient._handle_error(self, error) 1908 self.thread_local.inside_error_handling = True 1909 if isinstance(error, grpc.RpcError): -> 1910 self._handle_rpc_error(error) 1911 elif isinstance(error, ValueError): 1912 if "Cannot invoke RPC" in str(error) and "closed" in str(error): File /databricks/spark/python/pyspark/sql/connect/client/core.py:1985, in SparkConnectClient._handle_rpc_error(self, rpc_error) 1982 info = error_details_pb2.ErrorInfo() 1983 d.Unpack(info) -> 1985 raise convert_exception( 1986 info, 1987 status.message, 1988 self._fetch_enriched_error(info), 1989 self._display_server_stack_trace(), 1990 ) from None 1992 raise SparkConnectGrpcException(status.message) from None 1993 else:

syleeie2310 commented 3 months ago

@soojeonglim 님 몇개 권한을 변경해봤는데 da_cluster에서 다시 시도해봐주실 수 있을까요?

이번에 시도해서 안되면 수정님 비밀번호 바꾼 다음에 slack dm으로 저한테 알려주시면 제가 테스트 해봐야 될듯 해요.

soojeonglim commented 3 months ago

hive_metastore에 리뷰, 메타 데이터 각각 합쳐서 업로드 완료했습니다. 체크 부탁드립니당! [파일명]

-> 데이터브릭스에서 사용한 노트북 코드 파일을 깃헙 제 브런치에 업로드 해두려고 했는데 방법을 잘 모르겠습니다..ㅜ