mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Rename metadata tables and add schema to docs, refs #2382
This commit is contained in:
parent
8dc9bfa2ab
commit
2b0a61ee19
5 changed files with 173 additions and 48 deletions
|
|
@ -40,3 +40,26 @@ def config_example(
|
|||
cog.out(" .. code-block:: json\n\n")
|
||||
cog.out(textwrap.indent(json.dumps(data, indent=2), " "))
|
||||
cog.out("\n")
|
||||
|
||||
|
||||
def internal_schema(cog):
|
||||
import asyncio
|
||||
from datasette.app import Datasette
|
||||
from sqlite_utils import Database
|
||||
|
||||
ds = Datasette()
|
||||
db = ds.get_internal_database()
|
||||
|
||||
def get_schema(conn):
|
||||
return Database(conn).schema
|
||||
|
||||
async def inner():
|
||||
await ds.invoke_startup()
|
||||
await ds._refresh_schemas()
|
||||
return await db.execute_fn(get_schema)
|
||||
|
||||
schema = asyncio.run(inner())
|
||||
cog.out("\n.. code-block:: sql")
|
||||
cog.out("\n\n")
|
||||
cog.out(textwrap.indent(schema, " "))
|
||||
cog.out("\n\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue