This repo contains a framework and example for using FME to generate a PYVIS Network Visualization while controlling the variables of the network.
This was generated from the Microsoft 2019 Adventure Works Sample Database
The general idea is to map the relationships between source and desintation nodes in a network. In this case, the source and destination nodes are tables and table views as returned by the below (or similar) query. This could also be done by mapping the PK/FK keys in the database, however, the python script inside the FME workspace was written explicitly to identify and format VIEWS and TABLES to idenfity the relationships between the objects.
select distinct schema_name(v.schema_id) as schema_name,
v.name as view_name,
V.type_desc as view_type,
o.name as referenced_entity_name,
o.type_desc as entity_type
from sys.views v
join sys.sql_expression_dependencies d
on d.referencing_id = v.object_id
and d.referenced_id is not null
join sys.objects o
on o.object_id = d.referenced_id
order by schema_name,
view_name;
A few different python modules need to be installed into the FME Python Directory for this to function correctly
- Modules needed - pandas, networkx, matplotlib, pyvis
- FME Documentation for Python
- Windows command line example:
fme.exe python -m pip install pandas --target C:\Users\<user>\Documents\FME\Plugins\Python
- Linux command line example:
./fme python -m pip install pandas --target ~/Library/Application\ Support/FME/Plugins/Python
2.Database Connections
This repo has two examples.
- One workspace using a local JSON file (contained in the ExampleData folder)
- One utilizing a direct SQL database connection.
* If you are unfamiliar with database connections and do not have any SQL connections set up, I suggest you use the ExampleData and the GenerateSQLDiagrams_JSON_FILE_LOCAL.fmwt file
- Download file
- Open in Browser
Sales.HTML Screenshot below