Returing all fields in a find()

I would like to have a generic routine that returns all the fields in an entity given a find or find_one call.  RIght now, I believe I would have to provide all the field names int he call.  But then if an admin adds a field to the entity, I would have to fix code.   I guess I could use the schema calls to get the schema for the entity and create the return call, but was wondering if there was an easy way on the find call do to that and maybe that would be more efficient/


  • 0
    Patrick Wolf

    Are there any plans to include this in the API?


  • 0

    We removed this from the API a while ago because it was causing performance issues. As Chris mentioned, you can get all of the fields using a schema_field_read() and cache that info and pump it into your query so it's easy enough to do.

    What we found most lazy developers would do is just run find() and request 'all' fields when they usually only needed 2 or 3 field values. This adds up with a lot of scripts and can generate a tremendous amount of wasted bandwidth and so that's why we turned it off.

    Since it's probably easy enough to wrap your own method around schema_field_read() to mimic this behavior for the occasional cases when this is needed, not sure we'd want to re-enable that feature in general.



    Follow us on Twitter @shotgunsoftware and @shotgunsupport

  • 0
    Michael Oliver

    Would love to have this option available but I understand the reasoning.  Would love to be able to specify a project without having to specify a field name in sg.schema_field_read.  For now I'm using the following code:  


    filters = [

    fields = []
    for i in sg.schema_field_read(entity):

    item = sg.find(entity,filters,fields)




  • 0
    Adam Chrystie

    Thanks Michael Oliver....your example of listing all the fields of an entity helped me solve an issue.