Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SQL Storage Models for MySQL and MariaDB Support #4

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

TheophileDiot
Copy link
Contributor

Description

To ensure seamless compatibility with MySQL and MariaDB databases, we need to update column data types in our SQL storage models. The main objective of this update is to address a specific requirement in MySQL and MariaDB that requires a length specification for VARCHAR columns.

Exception Without the Update

Without these modifications, attempting to use sqlalchemy.String typed columns in MariaDB (or MySQL) results in the following error:

sqlalchemy.exc.CompileError: (in table 'machine_models', column 'machine_id'): VARCHAR requires a length on dialect mariadb

Changes Made

Modified Files

  • src/cscapi/sql_storage.py: Updated data types from sqlalchemy.String to sqlalchemy.TEXT to maintain the datatype while ensuring compatibility with MySQL and MariaDB dialects.

@rr404 rr404 self-assigned this Jan 19, 2024
@rr404 rr404 added the enhancement New feature or request label Jan 19, 2024
Copy link
Collaborator

@rr404 rr404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

thanks

@rr404 rr404 merged commit b21b6b4 into crowdsecurity:main Jan 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants