SOLVED Instantiating AssetDatabaseStruct

@ferdinand - Would you be able to provide any additional guidance on how to do this using Python? Specifically, the appropriate way to define a new "AssetDatabaseStruct" so it can be added as an argument for "AssetDataBasesInterface.SetDatabases(newDataBases)"?

The documentation shows-

AssetDatabaseStruct.__init__(otherOrDbUrl, active=True, exportOnSaveProject=True, isBuiltin=False)

Which I'm trying to use in this manner -

dbStruct = AssetDatabaseStruct(otherOrDbUrl="C:/path/to/pre-existing/database/dir", active=True, exportOnSaveProject=True, isBuiltin=False)

But printing out the dbStruct yields -

_dbUrl: relative:///otherOrDbUrl, _active: True, _exportOnSaveProject: True, _isBuiltin: False

The path isn't taking. I'm assuming "otherOrDbUrl" is a string unix path to the database folder.

Now contrast this to what prints out after collecting AssetDatabaseStructs from -

AssetDataBasesInterface.GetDatabases()

which returns-

_dbUrl: file:///C:/path/to/pre-existing/database/dir, _active: True, _exportOnSaveProject: True, _isBuiltin: False

I can't seem to find any examples on this and the documentation is a bit light (or I'm a bit dense, one of the two). Also I'm still a bit muddy on the differences between an asset database and an asset repository (bonus points if you can shed some light).

Thank you,
Clayton

Hello @clayton_krause,

Thank you for reaching out to us. Please follow the rule of creating your own topics for your own questions, unless your question is a direct follow-up question for another thread (which was here not the case, as this was a different question for a different language). I have forked your question.

I am not sure if you are aware, but we provide a Python version of the C++ Asset API examples (at least a subset of the examples). You can find them here. I would also recommend reading the C++ Asset API Handbook, as it explains some abstract concepts. There is also a Python Manual for the Asset API, but it is very minimal. You should read the C++ one.

Database vs Repository clarification would still be useful if you're game!

Yeah, that is confusing, we got the terminology a bit backwards there. I.e., what we call a database most people would likely consider to be a repository, and what we call a repository most people likely would consider to be a database.

  • An asset database refers to the physical location where a set of assets is being stored (i.e., what is usually called a repository). An asset database is represented by AssetDatabaseStruct and the common user usually has not to deal with asset databases, unless he/she wants to build an asset repository for a specific set of assets.
  • An asset repository is the logical interface that is being used to access an asset database (i.e., an asset repository is what is usually is associated with the concept of a database). Asset repositories can represent one to many databases and provide the common functionalities of databases such as searching, inserting, deleting, and updating.

If you want to know more, I would recommend reading Asset Databases.

Cheers,
Ferdinand

I had a moment of clarity after my previous post...

The "otherOrDbUrl" flag used to init a new "AssetDatabaseStruct" is a maxon.Url object...

This is not specified in the documentation from what I saw. Probably would be advantageous to include the types that are being passed as arguments.

At any rate, answered my own question. Database vs Repository clarification would still be useful if you're game!

Thank you!

Hello @clayton_krause,

Thank you for reaching out to us. Please follow the rule of creating your own topics for your own questions, unless your question is a direct follow-up question for another thread (which was here not the case, as this was a different question for a different language). I have forked your question.

I am not sure if you are aware, but we provide a Python version of the C++ Asset API examples (at least a subset of the examples). You can find them here. I would also recommend reading the C++ Asset API Handbook, as it explains some abstract concepts. There is also a Python Manual for the Asset API, but it is very minimal. You should read the C++ one.

Database vs Repository clarification would still be useful if you're game!

Yeah, that is confusing, we got the terminology a bit backwards there. I.e., what we call a database most people would likely consider to be a repository, and what we call a repository most people likely would consider to be a database.

  • An asset database refers to the physical location where a set of assets is being stored (i.e., what is usually called a repository). An asset database is represented by AssetDatabaseStruct and the common user usually has not to deal with asset databases, unless he/she wants to build an asset repository for a specific set of assets.
  • An asset repository is the logical interface that is being used to access an asset database (i.e., an asset repository is what is usually is associated with the concept of a database). Asset repositories can represent one to many databases and provide the common functionalities of databases such as searching, inserting, deleting, and updating.

If you want to know more, I would recommend reading Asset Databases.

Cheers,
Ferdinand

@ferdinand - Thank you! Apologies about not following forum protocol. I wanted to consolidate to avoid duplicate posts, but understand the desire to have separation between Python / C++ conversations.

I will reference the C++ material you linked for additional background. Thank you for the straightforward explanation between database and repository.

Best,
Clayton

Hello @clayton_krause,

without any further questions or other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022.

Thank you for your understanding,
Ferdinand