Drop an Oracle-Loaded XSD in Python

Posted by in Software

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…read more

Loading Dependent XSDs in Oracle through Python

Posted by in Software

One essential feature is that schemas can refer to other schemas. Oracle supports it via the schemaURL parameter. In other words, the url of the referred schema must be the same as the schemaURL parameter used to register the referred schema. One consequence of this feature is the necessity to provide a load order of schemas. In my case, The order would look like this:

The loader segment would be something similar to:

This is all trivial, except the INSERT_STR. A simple sample would be:

Note: Please…read more

UPSERT (update or insert) in Oracle with Python

Posted by in Software

One of the things I had to do is to build a script to upload data (e.g. the content of a list of files) into a database with a single table. My table has 3 columns: ID – a 20-character string identifier with PK properties (unique) ARTICLE– an XMLType element with the article details CITEDBY – an XMLType element with citations data The problem is that some of the data is already in the database and it may only need updating. Following this question, the selected strategy is to perform…read more

Memory dump: Work with XMLField in Oracle (part 3)

Posted by in Software

TL;DR: Here I present how to insert data with python in the table created at the previous step. Table of Contents Part 1 – Prerequisites Part 2 – Create a table and perform a SELECT Part 3 – User Python to insert data Part 4 – references In the previous entry, I’ve finished by creating the table, loading an entry manually and query it. Everything was done via SQL, so repeating the same process for a large number of XMLs is not really an idea I’d entertain too much. As…read more