mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Start of PostgreSQL prototype, refs #670
This prototype demonstrates the database page working against a hard-coded connection string to a PostgreSQL database. It lists tables and their columns and their row count.,
This commit is contained in:
parent
0091dfe3e5
commit
32a2f5793a
2 changed files with 206 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import os
|
|||
|
||||
from datasette.utils import to_css_class, validate_sql_select
|
||||
from datasette.utils.asgi import AsgiFileDownload
|
||||
from datasette.postgresql_database import PostgresqlDatabase
|
||||
|
||||
from .base import DatasetteError, DataView
|
||||
|
||||
|
|
@ -22,7 +23,12 @@ class DatabaseView(DataView):
|
|||
request, database, hash, sql, _size=_size, metadata=metadata
|
||||
)
|
||||
|
||||
db = self.ds.databases[database]
|
||||
# db = self.ds.databases[database]
|
||||
db = PostgresqlDatabase(
|
||||
self.ds,
|
||||
"simonwillisonblog",
|
||||
"postgresql://postgres@localhost/simonwillisonblog",
|
||||
)
|
||||
|
||||
table_counts = await db.table_counts(5)
|
||||
views = await db.view_names()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue