Re: Programmatic access to the SQL tab of pgadmin

From: Ni Ne <nineoften(at)hotmail(dot)com>
To: Thomas Kaliakos <tkaliakos(at)gmail(dot)com>, "pgadmin-support(at)lists(dot)postgresql(dot)org" <pgadmin-support(at)lists(dot)postgresql(dot)org>
Subject: Re: Programmatic access to the SQL tab of pgadmin
Date: 2022-02-21 16:35:53
Message-ID: CY4PR06MB2486F75CEFB4CACBF6EE1A6AB53A9@CY4PR06MB2486.namprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-admin

I don't have any input, but am eager to know if you are able to solve this. I too am very interested in retrieving the DDL info that pgAdmin provides.

If you search the history for this mailing list, I had asked about something similar a month or so ago. Someone had responded with some hints about modules that may reveal the same info.

Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Thomas Kaliakos <tkaliakos(at)gmail(dot)com>
Sent: Monday, February 21, 2022 7:44:59 AM
To: pgadmin-support(at)lists(dot)postgresql(dot)org <pgadmin-support(at)lists(dot)postgresql(dot)org>
Subject: Programmatic access to the SQL tab of pgadmin

Hi all,

TL;DR; Can I run pgadmin locally without the CSRF token check?
Longer version:
I would like to retrieve the output of the SQL tab in pgadmin for various resources (tables, views, functions, etc.) programmatically.
I discovered that this might be possible if we send an http request to a running pgadmin address and using a url of the format:
http://localhost:8011/browser/function/sql/1/1/215863/215876/607033
(where the numbers represent the server group id, the server id, the database id, the schema id and the oid of the function)
When I curl to this URL though I get the error that The CSRF token is missing.
I tried running pgadmin in debug mode, setting the csrf headers to an empty list ( PGADMIN_CONFIG_WTF_CSRF_HEADERS=[]), but none of those worked.
Is there any easy way I could retrieve the contents of the SQL tab?
Any help would be greatly appreciated 🙏🙏

--
Thanks,
Thomas
@tkaliakos<https://twitter.com/tkaliakos>

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message frank77-postgres 2022-02-21 17:57:36 Cannot authenticate: "SCRAM authentication requires libpq 10 or later"
Previous Message Thomas Kaliakos 2022-02-21 14:44:59 Programmatic access to the SQL tab of pgadmin

Browse pgsql-admin by date

  From Date Subject
Next Message Axel Rau 2022-02-21 17:28:01 Can't drop subscription
Previous Message Marcia Rocha 2022-02-21 16:17:29 postgresql14-contrib does not install with libpython 3.7