|
14 | 14 | command="npx",
|
15 | 15 | args=[
|
16 | 16 | "-y",
|
17 |
| - "@bytebase/dbhub@0.1", |
| 17 | + "@bytebase/dbhub@0.2.3", |
18 | 18 | "--transport=stdio",
|
19 | 19 | #"--transport=sse",
|
20 | 20 | #"--port=8080",
|
@@ -43,18 +43,21 @@ async def run():
|
43 | 43 |
|
44 | 44 | # Validate database content.
|
45 | 45 | db = DatabaseAdapter("crate://crate@localhost:4200/")
|
46 |
| - db.run_sql("CREATE TABLE IF NOT EXISTS public.testdrive (id INT, data TEXT)") |
47 |
| - db.run_sql("INSERT INTO public.testdrive (id, data) VALUES (42, 'Hotzenplotz')") |
| 46 | + db.run_sql("CREATE TABLE IF NOT EXISTS testdrive.dbhub (id INT, data TEXT)") |
| 47 | + db.run_sql("INSERT INTO testdrive.dbhub (id, data) VALUES (42, 'Hotzenplotz')") |
48 | 48 | db.refresh_table("public.testdrive")
|
49 | 49 |
|
50 |
| - # Read a few resources. |
51 |
| - # FIXME: Only works on schema=public, because the PostgreSQL adapter hard-codes `WHERE table_schema = 'public'`. |
52 |
| - # https://github.com/bytebase/dbhub/blob/09424c8513c8c7bef7f66377b46a2b93a69a57d2/src/connectors/postgres/index.ts#L89-L107 |
53 |
| - await client.read_resource("db://tables") |
| 50 | + # Read available resources. |
| 51 | + await client.read_resource("db://schemas") |
54 | 52 |
|
55 |
| - # Get a few prompts. |
56 |
| - await client.get_prompt("generate_sql", arguments={"description": "Please enumerate the highest five mountains.", "dialect": "postgres"}) |
57 |
| - await client.get_prompt("explain_db", arguments={"target": "testdrive"}) |
| 53 | + # Invoke available prompts. |
| 54 | + await client.get_prompt("generate_sql", arguments={ |
| 55 | + "description": "Please enumerate the highest five mountains.", |
| 56 | + "dialect": "postgres", |
| 57 | + "schema": "sys", |
| 58 | + }) |
| 59 | + await client.get_prompt("explain_db", arguments={"schema": "testdrive"}) |
| 60 | + await client.get_prompt("explain_db", arguments={"schema": "testdrive", "table": "dbhub"}) |
58 | 61 |
|
59 | 62 |
|
60 | 63 | if __name__ == "__main__":
|
|
0 commit comments