Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Datasette' object has no attribute 'table_metadata' #2316

Open
andig opened this issue Apr 5, 2024 · 6 comments
Open

'Datasette' object has no attribute 'table_metadata' #2316

andig opened this issue Apr 5, 2024 · 6 comments

Comments

@andig
Copy link

andig commented Apr 5, 2024

After importing a new table I'm getting

'Datasette' object has no attribute 'table_metadata'

when starting datasette and browsing to table. This is the backtrace:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/app.py", line 1668, in route_path
    response = await view(request, send)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/app.py", line 1861, in async_view_fn
    response = await async_call_with_supported_arguments(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/utils/__init__.py", line 1021, in async_call_with_supported_arguments
    return await fn(*call_with)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/views/table.py", line 747, in table_view
    response = await table_view_traced(datasette, request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/views/table.py", line 897, in table_view_traced
    await datasette.render_template(
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/app.py", line 1352, in render_template
    return await template.render_async(template_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/jinja2/environment.py", line 1324, in render_async
    return self.environment.handle_exception()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/templates/table.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/templates/base.html", line 62, in top-level template code
    {% block content %}
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/templates/table.html", line 27, in block 'content'
    {% set action_links, action_title = actions(), "View actions" if is_view else "Table actions" %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/jinja2/async_utils.py", line 65, in auto_await
    return await t.cast("t.Awaitable[V]", value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/views/table.py", line 1420, in actions
    extra_links = await await_me_maybe(hook)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/utils/__init__.py", line 115, in await_me_maybe
    value = await value
            ^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette_graphql/__init__.py", line 235, in inner
    db_schema = await schema_for_database_via_cache(datasette, database=database)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette_graphql/utils.py", line 81, in schema_for_database_via_cache
    schema = await schema_for_database(datasette, database)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette_graphql/utils.py", line 97, in schema_for_database
    table_metadata = await db.execute_fn(
                     ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/database.py", line 282, in execute_fn
    return await asyncio.get_event_loop().run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette/database.py", line 280, in in_thread
    return fn(conn)
           ^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette_graphql/utils.py", line 98, in <lambda>
    lambda conn: introspect_tables(conn, datasette, db.name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/datasette/0.64.6_2/libexec/lib/python3.12/site-packages/datasette_graphql/utils.py", line 672, in introspect_tables
    datasette_table_metadata = datasette.table_metadata(
                               ^^^^^^^^^^^^^^^^^^^^^^^^

Not sure what makes this specific table different from the others?

@andig
Copy link
Author

andig commented Apr 8, 2024

Anything I can contribute to diagnose/fix this? Right now datasette (installed via Homebrew) is useless as it crashes on almost any table.

@tddschn
Copy link

tddschn commented Apr 12, 2024

Got the same error.

@simonw
Copy link
Owner

simonw commented Apr 12, 2024

This looks like a bug in the GraphQL plugin. I'll take a look tomorrow.

@andig
Copy link
Author

andig commented Apr 14, 2024

Would be great to get this fixed as it makes datasette unusable in this case.

@andig
Copy link
Author

andig commented Apr 26, 2024

@simonw any update? I'm totally blocked on using datasette due to this error.

@andig
Copy link
Author

andig commented May 20, 2024

Friendly ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants