-[DOC] psl command : add description

This commit is contained in:
Sylvain LE GAL 2023-07-06 16:21:15 +02:00
parent 8a79974232
commit c813f3ddd4

View File

@ -39,6 +39,7 @@ and provides helpers to run (and replay) migrations until it works.
* [Command ``upgrade`` (BETA)](#command-upgrade) * [Command ``upgrade`` (BETA)](#command-upgrade)
* [Command ``generate-module-analysis`` (BETA)](#command-generate-module-analysis) * [Command ``generate-module-analysis`` (BETA)](#command-generate-module-analysis)
* [Command ``estimate-workload`` (BETA)](#command-estimate-workload) * [Command ``estimate-workload`` (BETA)](#command-estimate-workload)
* [Command ``psql``](#command-psql)
<a name="installation"/> <a name="installation"/>
@ -365,3 +366,72 @@ the work to do for the migration.
renaming or merging of modules) renaming or merging of modules)
- check that the analysis and migration have been done for the official - check that the analysis and migration have been done for the official
modules present in odoo/odoo modules present in odoo/odoo
<a name="command-psql"/>
## Command: ``psql``
**Prerequites:** init
```
odoo-openupgrade-wizard psql
--database DB_NAME
--command "SQL_REQUEST"
```
Execute an SQL Request on the target database.
**Optional arguments**
* If no ``database`` is provided, default ``postgres`` database will be used. exemple:
```
odoo-openupgrade-wizard psql --command "\l";
```
Result:
```
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
------------+-------+----------+------------+------------+-------------------
postgres | odoo | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | odoo | UTF8 | en_US.utf8 | en_US.utf8 | =c/odoo +
| | | | | odoo=CTc/odoo
template1 | odoo | UTF8 | en_US.utf8 | en_US.utf8 | =c/odoo +
| | | | | odoo=CTc/odoo
test_psql | odoo | UTF8 | en_US.utf8 | en_US.utf8 |
```
* if you execute request that return long result, you can choose to select ``pager`` or ``-no-pager``
option to display the result via the click function ``echo_via_pager``.
(see : https://click.palletsprojects.com/en/8.1.x/utils/#pager-support)
Note : Pager is enabled by default.
* you can pass extra psql arguments inline.
```
odoo-openupgrade-wizard psql
--database=test_psql
--command "select id, name from res_partner where name ilike '%admin%';"
-H
```
Result:
```
<table border="1">
<tr>
<th align="center">id</th>
<th align="center">name</th>
</tr>
<tr valign="top">
<td align="right">3</td>
<td align="left">Administrator</td>
</tr>
</table>
<p>(1 row)<br />
</p>
```
See all the options here https://www.postgresql.org/docs/current/app-psql.html