Find schema fields that were created on a certain day


due to a hiccup our Moxion integration I am left with tons of custom fields in my Shot schema which I now need to remove (those fields were meant to be created in a custom entity but somehow ended up in my Shot schema which may well have been user error in editorial).

Anyway, now I have written a script to compare fields that exist in both the custom entity as well as the Shot entity, but as an extra sanity check I would like to limit that list to only fields that were created on a certain day.
Can somebody help me out with the syntax here?

This is what I got at the moment, how can I now query each field’s creation date:

shot_schema = sg.schema_field_read("Shot")
moxion_schema = sg.schema_field_read("CustomEntity03")
shot_fields = set(shot_schema.keys())
moxion_fields = set(moxion_schema.keys())
exclude_list = ["sg_status_list"]
for common_field in shot_fields.intersection(moxion_fields):
    if common_field.startswith("sg") and (common_field not in exclude_list):
        #sg.field_delete("Shot", common_field) # not running this until I'm 100% sure

Thanks in advance,


Hi @frank!

I think I have a possible solution for you: There is an entity in Shotgun called Field that describes the fields of other entities (kinda meta-filed). If you query that I think you should be able to extract the creation date and filter by it.

Hope that helps!


Thanks Fabian, I will try that.