Failed to create indexes for collection 'user_details': Unknown attribute: firstName
- 0
- Self Hosted
- Databases
Hi everyone, i am using a python script in order to seed my database and so far i am able to do so but it fails on the index creation. I am running appwrite version 1.5.4 self hosted. However when it tries to create the indexes it fails with the following message :Failed to create indexes for collection 'user_details': Unknown attribute: firstName. Here is the code i use to create the indexes i even check that the attributes i require for the index exists # Create collection indexes for user_details
try:
user_details_collection = databases.get_collection(
database_id=database_id, collection_id=collection_ids["user_details"]
)
user_details_attributes = [
attr["key"] for attr in user_details_collection["attributes"]
]
if (
"firstName" in user_details_attributes
and "lastName" in user_details_attributes
and not user_details_collection["indexes"]
):
databases.create_index(
database_id=database_id,
collection_id=collection_id,
key="nameIndex",
type=IndexType.UNIQUE,
attributes=["firstName", "lastName"],
)
databases.create_index(
database_id=database_id,
collection_id=collection_id,
key="dobIndex",
type=IndexType.KEY,
attributes=["dateOfBirth"],
)
else:
print(
f"Cannot create indexes for collection '{collection}': Required attributes do not exist."
)
except Exception as e:
print(f"Failed to create indexes for collection 'user_details': {str(e)}")
What do i do wrong ?
Recommended threads
- User ID case sensitivity
I see that through REST (and SDK as well), getting a user is not case sensitive. And even though documentation does not clearly state that it is, the wording "V...
- Any way to temporarily bypass the email ...
Hey guys, any way to bypass the email verification to use the accounts again? i need to recover some projects that due to recent changes have been stopped, and ...
- How to use Sites on selfhosted appwrite
whenever I try to create a site even with template it says 404 nginx error