Re: Adding new server in pgadmin from command line

From: Yogesh Mahajan <yogesh(dot)mahajan(at)enterprisedb(dot)com>
To: Asmita Thapliyal <asmita(dot)thapliyal(at)gmail(dot)com>
Cc: "pgadmin-support lists(dot)postgresql(dot)org" <pgadmin-support(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding new server in pgadmin from command line
Date: 2022-05-04 11:58:14
Message-ID: CAMa=N=NxC9VG0zjibuFy+C3epCG6k0wiQjh6ga=XbWuXEJg76g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi Asmita,

No. pgAdmin does not provide any command line utility for user management.

Thanks,
Yogesh Mahajan
EnterpriseDB

On Wed, May 4, 2022 at 4:16 PM Asmita Thapliyal <asmita(dot)thapliyal(at)gmail(dot)com>
wrote:

> Thanks Yogesh! It works.
> Do we also have a command line for user management? Mainly I am looking
> for changing the roles associated with users.
>
> Regards,
> Asmita
>
> On Tue, May 3, 2022 at 3:38 PM Yogesh Mahajan <
> yogesh(dot)mahajan(at)enterprisedb(dot)com> wrote:
>
>> Hi Asmita,
>>
>> Here
>> <https://www.pgadmin.org/docs/pgadmin4/6.8/import_export_servers.html#importing-servers>
>> are the steps to add servers using command line. Inserting data entries
>> directly may lead to unexpected behaviour.
>>
>>
>> Thanks,
>> Yogesh Mahajan
>> EnterpriseDB
>>
>>
>> On Tue, May 3, 2022 at 2:39 PM Asmita Thapliyal <
>> asmita(dot)thapliyal(at)gmail(dot)com> wrote:
>>
>>> Hello Team,
>>>
>>> I would like to perform server addition activity in pgadmin from the
>>> command line.
>>> I tried to add newserver in pgadmin following below procedure.
>>>
>>> Create a migration file with the following command:
>>>
>>> (venv) $ FLASK_APP=pgAdmin4.py flask db revision
>>>
>>> This will create a file in: $PGADMIN4_SRC/web/migrations/versions/ . Add
>>> any changes to the 'upgrade' function. Increment the SCHEMA_VERSION in
>>> $PGADMIN4_SRC/web/pgadmin/model/init.py file.
>>> Below is the upgrade function command I am using.
>>>
>>> db.engine.execute("""
>>> INSERT INTO server (
>>> id, user_id, servergroup_id, name, host, port, maintenance_db,
>>> username, password, ssl_mode
>>> ) VALUES ( 1, 1, 1, "stagdb", "<hostname>", 5454, "mpsdb", "mproot",
>>> "<password>", "prefer" )
>>> """ )
>>> and restart pgadmin.
>>>
>>> But during pgdmin restart I get a db migration exception without any
>>> error details. Is this the correct procedure I am following? can we add
>>> servers in pgadmin from the command line instead of UI?
>>>
>>> Regards,
>>> Asmita
>>>
>>

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Schroeder, Steven 2022-05-05 16:52:38 LDAP issues
Previous Message Asmita Thapliyal 2022-05-04 10:46:24 Re: Adding new server in pgadmin from command line