# Assigning API Schemas using SDF PrimSpec

**URL:** https://forum.aousd.org/t/assigning-api-schemas-using-sdf-primspec/796
**Category:** USD
**Tags:** python
**Created:** [October 13, 2023, 10:39pm UTC](https://forum.aousd.org/t/assigning-api-schemas-using-sdf-primspec/796 "2023-10-13T22:39:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jul](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jul](https://forum.aousd.org/u/jul)
#### Post date: [October 13, 2023, 10:39pm UTC](https://forum.aousd.org/t/assigning-api-schemas-using-sdf-primspec/796/1 "2023-10-13T22:39:19Z")

</div>

Hello!  
In Python, I’ve been constructing layers using the SDF API following [this guide](https://lucascheller.github.io/VFX-UsdSurvivalGuide/core/elements/schemas.html). When creating Primitives using SDF, we can change the primitive info with the “SetInfo” call. However, the documentation [advises against using it](https://openusd.org/release/api/class_sdf_spec.html#ac24a378f12ee3162c6f0173d001b11c0).

So I wanted to ask what’s the recommended path to set info like prepending API Schemas through the Python SDF library or if it’s advised to instead use a USD prim for that.

Thanks!

---

<div class="post-metadata">

### Author: ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)
#### Post date: [October 13, 2023, 11:13pm UTC](https://forum.aousd.org/t/assigning-api-schemas-using-sdf-primspec/796/2 "2023-10-13T23:13:47Z")

</div>

Hi @jul - thanks for asking! In this case, because `apiSchemas` is defined by the usd module, which sits above sdf, there is no builtin API on SdfPrimSpec, so SetInfo _is_ the way to go. You can find examples of manipulating it on primSpecs in [fixbrokenpixarschemas.py](https://github.com/PixarAnimationStudios/OpenUSD/blob/10b62439e9242a55101cf8b200f2c7e02420e1b0/pxr/usd/bin/usdfixbrokenpixarschemas/usdfixbrokenpixarschemas.py#L4)

---

<div class="post-metadata">

### Author: ![BigRoyNL](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/bigroynl/32/413_2.png) [@BigRoyNL](https://forum.aousd.org/u/BigRoyNL)
#### Post date: [October 18, 2023, 2:56pm UTC](https://forum.aousd.org/t/assigning-api-schemas-using-sdf-primspec/796/3 "2023-10-18T14:56:05Z")

</div>

For anyone else lazy on that provided link - I believe [this `fixBrokenPixarSchemas.py`](https://github.com/PixarAnimationStudios/OpenUSD/blob/10b62439e9242a55101cf8b200f2c7e02420e1b0/pxr/usd/usdUtils/fixBrokenPixarSchemas.py#L70-L123) was the intended code area that does the `Sdf` access with `GetInfo` and `SetInfo` for the schemas.

---

<div class="post-metadata">

### Author: ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)
#### Post date: [October 18, 2023, 5:39pm UTC](https://forum.aousd.org/t/assigning-api-schemas-using-sdf-primspec/796/4 "2023-10-18T17:39:40Z")

</div>

Oops - thanks for the fix, @BigRoyNL !
