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
- Any example for using Appwrite with Verc...
Can not find an example on this.
- AppwriteException Network request failed...
I'm watching a react native / expo tutorila that uses Appwrite as it's backend for its database. So, in this tutorial, there is implementing the seed functional...
- Sites deployments don't auto start after...
Hey, I recently found out that when our docker service restarts (for whatever reason, usually me poking around in config) each site deployment need to be manual...