# Use Shotgun query folder for Project entity in schema

**URL:** <https://community.shotgridsoftware.com/t/use-shotgun-query-folder-for-project-entity-in-schema/8548>\
**Category:** Pipeline Integrations\
**Tags:** cm-metrics\
**Created:** [May 6, 2020, 6:58pm UTC](https://community.shotgridsoftware.com/t/use-shotgun-query-folder-for-project-entity-in-schema/8548 "2020-05-06T18:58:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keikun](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@keikun](https://community.shotgridsoftware.com/u/keikun)\
**Post date:** [May 6, 2020, 6:58pm UTC](https://community.shotgridsoftware.com/t/use-shotgun-query-folder-for-project-entity-in-schema/8548/1 "2020-05-06T18:58:01Z")

</div>

Hello,

Is it possible to have a **Project** entity query folder with its name field set to ‘sg\_project\_number’ under the main root folder?

Here is the sg\_project\_number.yml I wrote.

```
type: "shotgun_entity"

entity_type: Project

name: "sg_project_number"

filters:
- {"path": "project", "relation", "is", "values": ["$project"]}

field_name: "sg_project_number"

```

As a result with the yml, the Shotgun desktop console caught KeyError: ‘project’ as it tried to get a value by “value = rec[field]” from tk-core\python\tank\folder\folder\_types\entity.py.

It would be great if anyone knows there is a proper solution or workaround on this.

Thanks

---

<div class="post-metadata">

**Author:** ![philip.scadding](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/philip.scadding/32/30_2.png) [@philip.scadding](https://community.shotgridsoftware.com/u/philip.scadding)\
**Post date:** [May 11, 2020, 9:14am UTC](https://community.shotgridsoftware.com/t/use-shotgun-query-folder-for-project-entity-in-schema/8548/2 "2020-05-11T09:14:08Z")

</div>

Hi @keikun welcome to the forums!

Unfortunately, I don’t believe this is possible.  
The project root folder must always use the `tank_name` field value from the Shotgun `Project` entity. And you can’t make an entity folder that is a project type.

There are a couple of things you can do, I’m not sure if they would help in your situation.

1. The `tank_name` value can contain path separators if you want to have a nested project root, e.g. `project_code/project_name`.
2. You can add the project folder as part of a different entity folder, using [this technique](https://support.shotgunsoftware.com/hc/en-us/articles/219039868-Integrations-File-System-Reference#Multiple%20folders). For example you could get a project folder created when creating an asset folder using `name: "{project.Project.sg_project_number}/{code}"`. However, you would still be required to have the project folder at the root based on the `tank_name` value, as well.

---

<div class="post-metadata">

**Author:** ![keikun](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@keikun](https://community.shotgridsoftware.com/u/keikun)\
**Post date:** [May 11, 2020, 3:32pm UTC](https://community.shotgridsoftware.com/t/use-shotgun-query-folder-for-project-entity-in-schema/8548/3 "2020-05-11T15:32:55Z")

</div>

Thank you for your excellent workaround solution on this, @philip.scadding. Yes, containing path separators achieved what I need in the schema. Thank you!
