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
- SELF HOSTING ISSUE, DATA NOT MIGRATING T...
Hey, devs, I recently tried to migrate my cloud instance to a self hosted version but my data is not transferred fully only the table structure is transferred ...
- No Document ID?
Hi I have a self hosted appwrite. My documents get a document ID but are not visible in the console. I don't know why this happens and how to fix this
- How to determine if a user is anonymous?
This is probably a silly question, but I have not yet found a good answer. Is there a method to determine if the current session is anonymous aside from seein...