You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create the same table names and relations structure in different schemas. This leads to the same FK name. Dont't pay attention to our use case, we can work with different table names, but I wanted to report that when trying to set the FK names to something else using the fk_name parameter, it doesn't work.
Creating this schema with the method generate_mapping(check_tables=False, create_tables=True) throws an exception:
File ".../venv/lib/python3.10/site-packages/pony/orm/core.py", line 1127, in generate_mapping
table.add_foreign_key(attr.reverse.fk_name, child_columns, parent_table, parent_columns, attr.index,
File ".../venv/lib/python3.10/site-packages/pony/orm/dbschema.py", line 205, in add_foreign_key
return table.schema.fk_class(fk_name, table, child_columns, parent_table, parent_columns, index_name, on_delete,
File ".../venv/lib/python3.10/site-packages/pony/orm/dbschema.py", line 361, in __init__
throw(DBSchemaError, 'Foreign key %s cannot be created, name is already in use' % name)
File ".../venv/lib/python3.10/site-packages/pony/utils/utils.py", line 99, in throw
raise exc
pony.orm.core.DBSchemaError: Foreign key fk_entity__referenced cannot be created, name is already in use
I am trying to create the same table names and relations structure in different schemas. This leads to the same FK name. Dont't pay attention to our use case, we can work with different table names, but I wanted to report that when trying to set the FK names to something else using the fk_name parameter, it doesn't work.
Creating this schema with the method generate_mapping(check_tables=False, create_tables=True) throws an exception:
I am not seeing anything wrong in my code according to the documentation for the fk_name parameter
The text was updated successfully, but these errors were encountered: