Skip to content

Commit

Permalink
fix: Extend DataTableColumn type column length (pinterest#1121)
Browse files Browse the repository at this point in the history
  • Loading branch information
baumandm authored and aidenprice committed Jan 3, 2024
1 parent 9f10a39 commit a2ea03f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""Extend DataTableColumn type length
Revision ID: 27ed76f75106
Revises: 63bde0162416
Create Date: 2023-01-05 09:43:06.639449
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = "27ed76f75106"
down_revision = "63bde0162416"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"data_table_column",
"type",
nullable=True,
existing_type=sa.String(length=255),
type_=sa.String(length=4096),
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"data_table_column",
"type",
nullable=True,
existing_type=sa.String(length=4096),
type_=sa.String(length=255),
)
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions querybook/server/const/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
now = datetime.datetime.utcnow
utf8mb4_name_length = 191
name_length = 255
type_length = 4096
password_length = 255
description_length = 5000
text_length = 65535
Expand Down
3 changes: 2 additions & 1 deletion querybook/server/models/metastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
description_length,
url_length,
mediumtext_length,
type_length,
)
from const.metastore import DataTableWarningSeverity
from lib.sqlalchemy import CRUDMixin, TruncateString
Expand Down Expand Up @@ -283,7 +284,7 @@ class DataTableColumn(TruncateString("name", "type", "comment"), Base):
updated_at = sql.Column(sql.DateTime, default=now)

name = sql.Column(sql.String(length=name_length), index=True)
type = sql.Column(sql.String(length=name_length))
type = sql.Column(sql.String(length=type_length))

comment = sql.Column(sql.String(length=description_length))
description = sql.Column(sql.Text(length=mediumtext_length))
Expand Down

0 comments on commit a2ea03f

Please sign in to comment.