opendatacube / datacube-core

Open Data Cube analyses continental scale Earth Observation data through time
http://www.opendatacube.org
Apache License 2.0
514 stars 177 forks source link

How to remove product from PSQL database #980

Closed clausmichele closed 4 years ago

clausmichele commented 4 years ago

I want to delete a product and I know there is no user friendly way of doing it. After logging into the datacube DB i see this list of tables. Which one contains the product details?

                             List of relations
 Schema |                    Name                    |   Type   |  Owner
--------+--------------------------------------------+----------+----------
 public | accounts_activation                        | table    | user
 public | accounts_reset                             | table    | user
 public | auth_group                                 | table    | user
 public | auth_group_id_seq                          | sequence | user
 public | auth_group_permissions                     | table    | user
 public | auth_group_permissions_id_seq              | sequence | user
 public | auth_permission                            | table    | user
 public | auth_permission_id_seq                     | sequence | user
 public | auth_user                                  | table    | user
 public | auth_user_groups                           | table    | user
 public | auth_user_groups_id_seq                    | sequence | user
 public | auth_user_id_seq                           | sequence | user
 public | auth_user_user_permissions                 | table    | user
 public | auth_user_user_permissions_id_seq          | sequence | user
 public | cloud_coverage_cloudcoveragetask           | table    | user
 public | cloud_coverage_toolinfo                    | table    | user
 public | cloud_coverage_toolinfo_id_seq             | sequence | user
 public | cloud_coverage_userhistory                 | table    | user
 public | cloud_coverage_userhistory_id_seq          | sequence | user
 public | coastal_change_animationtype               | table    | user
 public | coastal_change_animationtype_id_seq        | sequence | user
 public | coastal_change_coastalchangetask           | table    | user
 public | coastal_change_toolinfo                    | table    | user
 public | coastal_change_toolinfo_id_seq             | sequence | user
 public | coastal_change_userhistory                 | table    | user
 public | coastal_change_userhistory_id_seq          | sequence | user
 public | custom_mosaic_tool_animationtype           | table    | user
 public | custom_mosaic_tool_animationtype_id_seq    | sequence | user
 public | custom_mosaic_tool_custommosaictooltask    | table    | user
 public | custom_mosaic_tool_resulttype              | table    | user
 public | custom_mosaic_tool_resulttype_id_seq       | sequence | user
 public | custom_mosaic_tool_toolinfo                | table    | user
 public | custom_mosaic_tool_toolinfo_id_seq         | sequence | user
 public | custom_mosaic_tool_userhistory             | table    | user
 public | custom_mosaic_tool_userhistory_id_seq      | sequence | user
 public | data_cube_manager_ingestiondetails         | table    | user
 public | data_cube_manager_ingestionrequest         | table    | user
 public | data_cube_manager_ingestionrequest_id_seq  | sequence | user
 public | dc_algorithm_application                   | table    | user
 public | dc_algorithm_application_areas             | table    | user
 public | dc_algorithm_application_areas_id_seq      | sequence | user
 public | dc_algorithm_application_satellites        | table    | user
 public | dc_algorithm_application_satellites_id_seq | sequence | user
 public | dc_algorithm_applicationgroup              | table    | user
 public | dc_algorithm_applicationgroup_id_seq       | sequence | user
 public | dc_algorithm_area                          | table    | user
 public | dc_algorithm_area_satellites               | table    | user
 public | dc_algorithm_area_satellites_id_seq        | sequence | user
 public | dc_algorithm_compositor                    | table    | user
 public | dc_algorithm_satellite                     | table    | user
 public | dc_algorithm_satellite_id_seq              | sequence | user
 public | django_admin_log                           | table    | user
 public | django_admin_log_id_seq                    | sequence | user
 public | django_content_type                        | table    | user
 public | django_content_type_id_seq                 | sequence | user
 public | django_migrations                          | table    | user
 public | django_migrations_id_seq                   | sequence | user
 public | django_session                             | table    | user
 public | fractional_cover_fractionalcovertask       | table    | user
 public | fractional_cover_toolinfo                  | table    | user
 public | fractional_cover_toolinfo_id_seq           | sequence | user
 public | fractional_cover_userhistory               | table    | user
 public | fractional_cover_userhistory_id_seq        | sequence | user
 public | slip_baselinemethod                        | table    | user
 public | slip_sliptask                              | table    | user
 public | slip_toolinfo                              | table    | user
 public | slip_toolinfo_id_seq                       | sequence | user
 public | slip_userhistory                           | table    | user
 public | slip_userhistory_id_seq                    | sequence | user
 public | spectral_anomaly_resulttype                | table    | user
 public | spectral_anomaly_resulttype_id_seq         | sequence | user
 public | spectral_anomaly_spectralanomalytask       | table    | user
 public | spectral_anomaly_toolinfo                  | table    | user
 public | spectral_anomaly_toolinfo_id_seq           | sequence | user
 public | spectral_anomaly_userhistory               | table    | user
 public | spectral_anomaly_userhistory_id_seq        | sequence | user
 public | spectral_indices_resulttype                | table    | user
 public | spectral_indices_resulttype_id_seq         | sequence | user
 public | spectral_indices_spectralindicestask       | table    | user
 public | spectral_indices_toolinfo                  | table    | user
 public | spectral_indices_toolinfo_id_seq           | sequence | user
 public | spectral_indices_userhistory               | table    | user
 public | spectral_indices_userhistory_id_seq        | sequence | user
 public | tsm_animationtype                          | table    | user
 public | tsm_animationtype_id_seq                   | sequence | user
 public | tsm_resulttype                             | table    | user
 public | tsm_resulttype_id_seq                      | sequence | user
 public | tsm_toolinfo                               | table    | user
 public | tsm_toolinfo_id_seq                        | sequence | user
 public | tsm_tsmtask                                | table    | user
 public | tsm_userhistory                            | table    | user
 public | tsm_userhistory_id_seq                     | sequence | user
 public | urbanization_toolinfo                      | table    | user
 public | urbanization_toolinfo_id_seq               | sequence | user
 public | urbanization_urbanizationtask              | table    | user
 public | urbanization_userhistory                   | table    | user
 public | urbanization_userhistory_id_seq            | sequence | user
 public | water_detection_animationtype              | table    | user
 public | water_detection_animationtype_id_seq       | sequence | user
 public | water_detection_resulttype                 | table    | user
 public | water_detection_resulttype_id_seq          | sequence | user
 public | water_detection_toolinfo                   | table    | user
 public | water_detection_toolinfo_id_seq            | sequence | user
 public | water_detection_userhistory                | table    | user
 public | water_detection_userhistory_id_seq         | sequence | user
 public | water_detection_waterdetectiontask         | table    | user
(106 rows)
Kirill888 commented 4 years ago

@clausmichele deleting product is an involved process due to various consistency constraints, I recommend you study gist linked below:

https://gist.github.com/omad/1ae3463a123f37a9acf37213bebfde86

clausmichele commented 4 years ago

Thanks, it works!