Skip to content

For ItemGraph class, add an option to write_to_file so the graph contents can be written to a JSON file instead of a GML file. #2276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrewrudin-austin opened this issue May 2, 2025 · 0 comments

Comments

@andrewrudin-austin
Copy link

Is your feature request related to a problem? Please describe.
No

<insert your code here>

Describe the solution you'd like
After an ItemGraph is created from various items in an org, have the ability to write the contents in bulk to a JSON file.

Describe alternatives you've considered
I guess the output format doesn't have to be JSON, but it should be something very universal to read like XML, CSV, etc. although I know in this case CSV doesn't make a great choice given the nested nature of the dependencies.

Another option is to have a way to output the seperate parts of the ItemGraph individually. For example, with one call I can export just the items (nodes) to a flat file format. Then with a 2nd call I export all the dependencies (edges) as a flat table with columns for the id of the item depending on another item, a 2nd column with the ID of the item it is depending on, and then extra columns to describe the nature of the dependency.

Additional context
Currently the only option on the write_to_file method is a GML file. I'm not an expert on graph database file types and I didn't see a reference to the GML format type used in the Esri Python documentation for this class, but I assume that it is the format here: https://gephi.org/users/supported-graph-formats/gml-format/. The data structure shown looks very similar to JSON with nested elements and brackets to wrap them. What's different is GML doesn't use colons to separate the property name from the value. So if you want to read the file downstream in another system, and that system isn't aware of the GML format which seems pretty niche, then you're stuck. JSON is more universally supported as a readable data format. For me I'm thinking of FME specifically. My goal here is to use this class in python to pull together the dependencies between 100's of items in my org, and then write all that data to a data catalog database (think an item table and a relationship table where it can be used for Power BI or AGOL Dashboards reporting on how data is used. I'd prefer to have this python class do the work and then spit out one file of all the relationships for me to then use downstream in FME to do the delta check with the database and write any changes in relationships to the table. Since FME doesn't support this GML format (as of FME 2025), I guess I'd have to have more python code to loop over all items in the ItemGraph object and spit the data out to some other format that is usable downstream in FME.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant