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

Initial work to support Starrocks DB #1561

Closed
wants to merge 1 commit into from

Conversation

maver1ck
Copy link
Contributor

I want to use Alembic with Starrocks database.

To achieve this I need to patch alembic_version table with following code

def patch_alembic_version(context, **kwargs):
    migration_context = context._proxy._migration_context
    old_version = migration_context._version
    metadata = old_version.metadata
    metadata.remove(old_version)

    version = Table(
        'alembic_version',
        metadata,
        Column('id', types.BIGINT, autoincrement=True, primary_key=True),
        Column('version_num', types.VARCHAR(32), primary_key=False),
        starrocks_primary_key="id"
    )
    migration_context._version = version

This solution works with one exception - select on alembic_version always read version_num from first column.

Description

Fixes: #1560

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

@zzzeek
Copy link
Member

zzzeek commented Oct 30, 2024

hi -

im not sure what problem you are having but this PR doesn't really make any sense, as it just adds a command to the select() here that would not really change anything since alembic_version already has just that one column.

Please open a discussion with a description of the actual problem you are having including complete error messages / stack trace and we can begin to see where your solution might be.

@zzzeek zzzeek closed this Oct 30, 2024
@maver1ck
Copy link
Contributor Author

maver1ck commented Oct 30, 2024

Hi @zzzeek
I created discussion with explanation of my problem.
#1562

Please take a look.
TL;DR; this change gives possibility to create alembic_version table with multiple columns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make version table customizable by dialects
2 participants