Drop an Oracle-Loaded XSD in Python

A loaded schema can be dropped if:

  • No other schema depends on it
  • No data using the schema is loaded

I think you may force unloading schemas even if there is data loaded but I haven’t tried that.

The code to drop a schema is:

You can use it if e.g. schema is updated or we don’t need it anymore.

The full code in Python is:

Several notes:

  • The order of removal is, of course, the reversed order of insertion. This way, complex XSDs are removed firse leaving basic dependencies at the end.
  • I’m using PL/SQL because it’s easier if all scripts are written in the same way. I could probably use simple SQL
  • I’m over-engineering the code a bit because I don’t want it to fail hard if a dependency was not loaded (it’s development code so e.g. the list of schemas can fail to load in the first place)

Note: Please refer to the previous article to see e.g. connection setup via cx_oracle


A little experiment: If you find this post and ad below useful, please check the ad out :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top