C4w4capstone1(5.2.3)

IN 5.2.3 It is giving me error.

InternalError_ Traceback (most recent call last)
File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1910, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
1909 if not evt_handled:
→ 1910 self.dialect.do_execute(
1911 cursor, statement, parameters, context
1912 )
1914 if self._has_events or self.engine._has_events:

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py:736, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
735 def do_execute(self, cursor, statement, parameters, context=None):
→ 736 cursor.execute(statement, parameters)

InternalError_: AwsClientException: EntityNotFoundException from glue - Entity Not Found

The above exception was the direct cause of the following exception:

InternalError Traceback (most recent call last)
Cell In[24], line 1
----> 1 get_ipython().run_line_magic(‘sql’, ‘select * from deftunes_transform.songs limit 10’)

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/IPython/core/interactiveshell.py:2480, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
2478 kwargs[‘local_ns’] = self.get_local_scope(stack_depth)
2479 with self.builtin_trap:
→ 2480 result = fn(*args, **kwargs)
2482 # The code below prevents the output from being displayed
2483 # when using magics with decorator @output_can_be_silenced
2484 # when the last Python token in the expression is a ‘;’.
2485 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sql/magic.py:217, in SqlMagic.execute(self, line, cell, local_ns)
214 return
216 try:
→ 217 result = sql.run.run(conn, parsed[“sql”], self, user_ns)
219 if (
220 result is not None
221 and not isinstance(result, str)
(…)
224 # Instead of returning values, set variables directly in the
225 # users namespace. Variable names given by column names
227 if self.autopandas:

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sql/run.py:367, in run(conn, sql, config, user_namespace)
365 else:
366 txt = sqlalchemy.sql.text(statement)
→ 367 result = conn.session.execute(txt, user_namespace)
368 _commit(conn=conn, config=config)
369 if result and config.feedback:

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1385, in Connection.execute(self, statement, *multiparams, **params)
1381 util.raise_(
1382 exc.ObjectNotExecutableError(statement), replace_context=err
1383 )
1384 else:
→ 1385 return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py:334, in ClauseElement._execute_on_connection(self, connection, multiparams, params, execution_options, _force)
330 def _execute_on_connection(
331 self, connection, multiparams, params, execution_options, _force=False
332 ):
333 if _force or self.supports_execution:
→ 334 return connection._execute_clauseelement(
335 self, multiparams, params, execution_options
336 )
337 else:
338 raise exc.ObjectNotExecutableError(self)

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1577, in Connection._execute_clauseelement(self, elem, multiparams, params, execution_options)
1565 compiled_cache = execution_options.get(
1566 “compiled_cache”, self.engine._compiled_cache
1567 )
1569 compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
1570 dialect=dialect,
1571 compiled_cache=compiled_cache,
(…)
1575 linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
1576 )
→ 1577 ret = self._execute_context(
1578 dialect,
1579 dialect.execution_ctx_cls._init_compiled,
1580 compiled_sql,
1581 distilled_params,
1582 execution_options,
1583 compiled_sql,
1584 distilled_params,
1585 elem,
1586 extracted_params,
1587 cache_hit=cache_hit,
1588 )
1589 if has_events:
1590 self.dispatch.after_execute(
1591 self,
1592 elem,
(…)
1596 ret,
1597 )

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1953, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
1950 branched.close()
1952 except BaseException as e:
→ 1953 self._handle_dbapi_exception(
1954 e, statement, parameters, cursor, context
1955 )
1957 return result

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py:2134, in Connection.handle_dbapi_exception(self, e, statement, parameters, cursor, context)
2132 util.raise
(newraise, with_traceback=exc_info[2], from_=e)
2133 elif should_wrap:
→ 2134 util.raise_(
2135 sqlalchemy_exception, with_traceback=exc_info[2], from_=e
2136 )
2137 else:
2138 util.raise_(exc_info[1], with_traceback=exc_info[2])

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/util/compat.py:211, in raise_(failed resolving arguments)
208 exception.cause = replace_context
210 try:
→ 211 raise exception
212 finally:
213 # credit to
214 # Exception leaks in Python 2 and 3 | Kristján's Cosmic Percolator
215 # as the traceback object creates a cycle
216 del exception, replace_context, from_, with_traceback

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py:1910, in Connection._execute_context(self, dialect, constructor, statement, parameters, execution_options, *args, **kw)
1908 break
1909 if not evt_handled:
→ 1910 self.dialect.do_execute(
1911 cursor, statement, parameters, context
1912 )
1914 if self._has_events or self.engine._has_events:
1915 self.dispatch.after_cursor_execute(
1916 self,
1917 cursor,
(…)
1921 context.executemany,
1922 )

File ~/workspace/jupyterlab-venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py:736, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
735 def do_execute(self, cursor, statement, parameters, context=None):
→ 736 cursor.execute(statement, parameters)

InternalError: (psycopg2.errors.InternalError_) AwsClientException: EntityNotFoundException from glue - Entity Not Found

[SQL: select * from deftunes_transform.songs limit 10]
(Background on this error at: Error Messages — SQLAlchemy 1.4 Documentation)

Hello @Kunal_Gurung
Based on this post, your Glue jobs had failed before. The error in getting data from the tables might be stemming from failed jobs. We will try to fix that first, and then we will get back to this.