When running the 02_load_raw.py file, I encountered the following error:
Loading country Failed to execute query [queryID: 01accf15-0302-122a-0001-a636000250a6] use schema RAW_POS 002043 (02000): SQL compilation error: Object does not exist, or operation cannot be performed. Traceback (most recent call last): File "02_load_raw.py", line 78, in <module> load_all_raw_tables(session) File "02_load_raw.py", line 54, in load_all_raw_tables load_raw_table(session, tname=tname, s3dir=s3dir, schema=schema) File "02_load_raw.py", line 26, in load_raw_table session.use_schema(schema) File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\snowpark\session.py", line 1763, in use_schema self._use_object(schema, "schema") File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\snowpark\session.py", line 1799, in _use_object self._run_query(f"use {object_type} {object_name}") File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\snowpark\session.py", line 1231, in _run_query return self._conn.run_query( File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\snowpark\_internal\server_connection.py", line 102, in wrap raise ex line 346, in run_query results_cursor = self._cursor.execute(query, params=params, **kwargs) File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\connector\cursor.py", line 904, in execute Error.errorhandler_wrapper(self.connection, self, error_class, errvalue) File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\connector\errors.py", line 290, in errorhandler_wrapper handed_over = Error.hand_to_other_handler( File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\connector\errors.py", line 345, in hand_to_other_handler cursor.errorhandler(connection, cursor, error_class, error_value) File ".\miniconda3\envs\pysnowpark\lib\site-packages\snowflake\connector\errors.py", line 221, in default_errorhandler raise error_class( snowflake.connector.errors.ProgrammingError: 002043 (02000): SQL compilation error: Object does not exist, or operation cannot be performed.
After testing it out in my own Snowflake instance, I found out that the query lacks a specification of which database to search for this schema. I fixed the issue by replacing line 45 in the load_all_raw_tables function in the 02_load_raw.py file with this:
schema = 'HOL_DB.' + data['schema']
After this, the whole script executed successfully.