lukas g

Members
  • Content count

    11
  • Joined

  • Last visited

  1. How to query all priorities and set priority

    Thank you very much. that was easy I did not even think about the regular query to get them
  2. Hey, I need to query all priorities and also set the priority of entities. sth. like thsi maybe: priorities = session.get_priorities() ? entity["priority"] = priorities[0] Best Lukas
  3. Make Custom Attributes Mandatory?

    Hi Mattias, it would be great if you could give me more information about your "popup dialog" suggestion and how it could be realized. And maybe you can tell me if there are plans for implementing such a feature like making attributes mandatory? Best regards Lukas
  4. Make Custom Attributes Mandatory?

    Hi, is it possible to make a custom attribute mandatory, so the user has to give it a value on creation using the Ftrack web gui? For example I want to have a text attribute like "my_extra_name" to be a mandatory information which the user has to supply on creation through the gui. Right now i see two ways for creating new DB instances of my object types but non forces the user to supply my extra data. (The first one at least offers the possibility to directly set the value for a custom attribute and makes i more prominent but it is not mandatory. The Second way does not even offer a direct way for setting any values other then the Name. The user has to select the new instance, open the info-box and fill in additional information there and then save.) Thanks for the help in advance Lukas
  5. Datetime Field ?

    Hi Mattias, the event query tip was very helpful! Thanks a lot for that. Now i am able to compare all DB entries with each other based on their latest update Regarding the arrow date issue. I was not able to get it to work with my custom attribute (But right now i don't rely on the custom date attribute anymore as i am using the nice event query)
  6. Datetime Field ?

    Is there a way to access the information when a database entry has been modified? (at which datetime the entry has been edited)
  7. Datetime Field ?

    Hello, I need to sync parts my ftrack database with parts of my inhouse database. For this reason I need support for a timestamp (Date AND time) which gets updated when a field has last been changed. How can i put datetime information into the ftrack database? The custom_attributes support the date field and if i query it i receive an arrow object. But when i try to set it to a new datetime i can only set it with a date but not with a time information. if i try to set it with time information i get an error: ServerError: Server reported error: IntegrityError(Custom attribute value for "my_time_stamp" must be a valid date. Got '2018-06-28T18:13:14.043000'.) Here is some code snippet: my_object = session.query("MyObjectType where name is MyName").first() my_time_stamp = my_object["custom_attributes"]["my_time_stamp"] log.debug("My Time Stamp: {}".format(my_time_stamp)) # >>> 2018-06-28T00:00:00+00:00 arrow_now = arrow.utcnow() log.debug("Arrow datetime: {}".format(arrow_now.datetime)) # >>> 2018-06-28 18:04:48.799000+00:00 log.debug("Arrow date: {}".format(arrow_now.date())) # >>> 2018-06-28 my_object["custom_attributes"]["my_time_stamp"] = arrow_now.date() I hope someone can guide me to the right direction. Best, Lukas
  8. Query Project Schema Objects

    Maybe there is another way of finding out which object types are assigned to my project so i can prevent a ServerError like this from happening: "ServerError: Server reported error: ValidationError(Object type u'Shot' cannot be created on project u'Lukas Dev'.)" The only solution i found for now i to try to create the desired types on startup to check if i can create them and catch the server error and show it to the TD to properly configure the ftrack project.
  9. Query Project Schema Objects

    Hello, I need to write some checks using the python api to make sure the current ftrack project is configured correctly. There fore i need to query the currents project Project Schema and check its configuration. Specifically: I need to query the assigned Objecty (ObjectTypes) of a Project Schema. I can access the the Types and objects with 'ProjectSchema.get_types()' as well as the statuses an by calling 'ProjectSchema.get_statuses()' but i can't find a way to actually figure out if an object (ObjectType) is assigned to the list of objects of the particular Project Schema. (I can easily find out if a specific object type exists at all using 'session.query("ObjectType where name is my_object_type_name")' but not which schemas it is assigned to.) I know from a different post, that creating new ProjectSchemas and "manage" them (editing them?) is only supported using the GUI. But What about retrieving the assigned Objects (ObjectTypes) ? It should be possible i guess. The Docs from ProjectSchema dont show any more methods: http://ftrack-python-api.rtd.ftrack.com/en/1.4.0/api_reference/entity/project_schema.html Examples for get_types() and get_statuses: http://ftrack-python-api.rtd.ftrack.com/en/1.4.0/example/project.html I Hope someone can help me out. Thank you in advance Lukas
  10. How to create new entity types with python api

    Hi Mattias, thank you for the quick reply and the welcoming That's unfortunate to hear not having access through the api for proper entity configuration. I can see this not being an easy task to tackle, hiding the underlying complexity from the api users but still giving enough control for flexible configurations. Do you have any information about when this might be addressed? (Talking about just a couple of months or more like a year or so?) Best Lukas
  11. Hello, My Question is: How can I create new entity types using the python api. when i create an new session object with the python api using: session = ftrack_api.Session(server_url=server_url, api_key=api_key, api_user=api_user) I can query all types using: session_types = session.types Now i am checking if all entity types our pipeline requires are present in this session using something like: session_types.get(required_entity) However if the expected entity types are NOT present -> meaning FTrack is not yet configured in the way the it needs to be for the pipeline. I want to create the missing entity types using the python api. In the GUI I would simply create new objects for each missing entity type like this: And then I would create a schema using the required objects / (entity types) and make sure that the projects are always using this schema: But I am having trouble to understand the correct way of doing so using the python api. As far as I understand the entity types are generated dynamically at the beginning of a session. The "StandardFactory" class takes care of it by creating the types specified in the existing "ProjectSchema" 's Workflow like so ? Create a new ProjectSchema? While doing so I pass in the new Entity Types I want to have created with this schema? But how can I define those new entity types? Some informatison from the docs I collected so far: " When a Session is constructed it fetches schema details from the connected server and then calls an Entity factory to create classes from those schemas. It does this by emitting a synchronous event, ftrack.api.session.construct entity-type, for each schema and expecting a class object to be returned. " http://ftrack-python-api.rtd.ftrack.com/en/stable/working_with_entities.html#customising-entity-types Regarding working with Project Schema's I only found these small snippets from the docs which do NOT show how to create a new schema: http://ftrack-python-api.rtd.ftrack.com/en/stable/example/project.html?highlight=schemas The information provided in the "Working with entities - Customising entity types" also links to this page "Understanding sessions - Configuring plugins" and the provided python file "cunstruct_entity_type.py" shows how to register a plugin but does not show how to actually create a new entity type. I hope someone can point me to the right direction! Thank you in advance, Lukas