I have a folder of independent .sql-files that are used by a FastAPI application to request data from the Oracle Database.

Each file includes a variable (e.g. :plot_fsk) that is later on modified using a function that changes variable in SQL query by means of the sqlalchemy.sql.text as shown here.

Here is the content of a single .sql-file

FROM DB_UTM.A_AA88888 A_AA88888
WHERE A_AA88888.FSK = :plot_fsk

For my documentation I would like to have the graphic representation of those .sql-files in a neat and user-friendly schematic manner. Is there any automatic approach to implement this task?

In that visualization I would like to include:

  • all the tables names
  • all the attributes that are requested in SELECT and WHERE with their original names
  • all the relations between tables, like different JOINs etc.
  • ORDER BY can be neglected

So, the above SQL query will look like:

fancy _diagram

I have seen some articles but none of them mention a visualization from an individual file (when the entire Database should not considered):

  • Can you be more specific on what needs to be in the visualization and what doesn't? For example, you write: "So, the above SQL query will look like:" I'd argue that in a general sense, that is not true, as there is information in the SQL query (such as the fact that only the AFL column is projected to the result set, and renamed and concatenated with a constant at that) that is not hinted at in the visualization sample you provide. Commented Jul 28, 2021 at 11:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.