Does Auto-truncation not work with mariadb? Or does it need to be manually turned on?
See original GitHub issueThis issue is in continuation of #3989
Describe the bug
Exact error received is:
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1059, "Identifier name 'fk_faculty_marks_assistant_department_subject_id_department_subject' is too long")
Expected behavior
Sqlalchemy should auto-truncate the constraint name as it is above 64 characters.
I am expecting this behaviour as the original issue is marked as fixed and closed.
To Reproduce
I don’t know how to create a unit test for naming conventions and alembic. Any example link will be appreciated.
The Naming Convention used:
convention = {
"ix": 'ix_%(column_0_N_label)s',
"uq": "uq_%(table_name)s_%(column_0_name)s",
"ck": "ck_%(table_name)s_%(constraint_name)s",
"fk": "fk_%(table_name)s_%(column_0_N_name)s_%(referred_table_name)s",
"pk": "pk_%(table_name)s"
}
Relevant models:
class DepartmentSubject(db.Model):
__tablename__ = 'department_subject'
id = db.Column(db.SmallInteger, primary_key=True)
class FacultyMarksAssistant(db.Model):
__tablename__ = 'faculty_marks_assistant'
department_subject_id = db.Column(
db.ForeignKey('department_subject.id'),
primary_key=True, nullable=False, index=True
)
Error
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1059, "Identifier name 'fk_faculty_marks_assistant_department_subject_id_department_subject' is too long")
Versions.
- OS: archlinux 5.9.14-arch1-1
- Python: 3.9.0
- SQLAlchemy: 1.3.20
- Database: mariadb Ver 15.1 Distrib 10.5.8-MariaDB, for Linux (x86_64) using readline 5.1
- DBAPI: mysqlclient 2.0.2
Additional context
the MySQL dialect has two separate lengths set up and these are likely not accommodated >correctly:
identifiers are 64, however aliases can be 255…
max_identifier_length = 255 max_index_name_length = 64
_Originally posted by @zzzeek in https://github.com/sqlalchemy/sqlalchemy/issues/3989#issuecomment-770219401_
Where would I find this and check?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Configuring MariaDB for Remote Client Access
How to configure MariaDB for remote client access.
Read more >What to Do if MariaDB Doesn't Start
There could be many reasons that MariaDB fails to start. This page will help troubleshoot some of the more common reasons and provide...
Read more >Troubleshooting Connection Issues - MariaDB Knowledge Base
Unable to Connect from a Remote Location. Usually, the MariaDB server does not by default accept connections from a remote client or connecting...
Read more >systemd - MariaDB Knowledge Base
To work around this, you can reconfigure the MariaDB systemd unit to have an ... if you are using systemd 236 or later,...
Read more >MariaDB Basics
In order to be able to add and to manipulate data, you first have to create a database structure. Creating a database is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
latest rel_1_3 branch + master should work now if you feel like testing, thanks for reporting!
pretty weird that most MySQL versions are not even applying this foreign key name to the foreign key constraint itself; only MySQL 8 is doing it. mariadb versions are naming the FK with a generated name and using the name on a related KEY element only.