Update Table
Alters the table specified with the table_name and schema to the Table object specified in the body parameter.
Instructions
In order to update an object, simply change the values of the Table objects in the request body. To delete, simply remove the object from the request body. To add, add the desired object to the request body.
The query is built in the following order:
DROP UNIQUE CONSTRAINT -> DROP PRIMARY KEY -> DROP FOREIGN KEY -> DROP COLUMN -> ADD COLUMN -> ALTER COLUMN -> RENAME COLUMN -> ADD UNIQUE CONSTRAINT -> ADD PRIMARY KEY -> ADD FOREIGN KEY -> RENAME TABLE -> SET SCHEMA
Caution:
For the columns, it is important to note that the id is the unique key used to identify the column. If you remove the column_id key from the Column object, it will be dropped from the database and be recreated.
Since there is a given order for execution, if your alter requires to not follow the order above, make sure to separate the API calls.
Parameters
- table_name: str,
- schema : str, default “public” The schema to retrieve the tables from. If no parameter is provided, defaults to “public”.
- body: AlterTableRequest, default None
Returns
A Table Pydantic object.
Authorizations
Enter: 'Bearer <JWT>', where JWT is the access token. Example: Bearer access_token_comes_here