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

[Feature] Alembic support #52581

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib/starrocks-python-client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"sqlalchemy>=2.0",
"sqlalchemy-utils>=0.41.2",
"pymysql>=1.1.0",
"alembic>=1.4.0"
],
setup_requires=["pytest-runner"],
tests_require=["pytest", "mock"],
Expand Down
2 changes: 1 addition & 1 deletion contrib/starrocks-python-client/starrocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.1.1"
__version__ = "1.2.0"
28 changes: 28 additions & 0 deletions contrib/starrocks-python-client/starrocks/alembic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from alembic.ddl.mysql import MySQLImpl
from sqlalchemy import Column
from sqlalchemy import BIGINT
from sqlalchemy import MetaData
from sqlalchemy import Table
from sqlalchemy import VARCHAR
from typing import Optional


class StarrocksImpl(MySQLImpl):
__dialect__ = "starrocks"

def version_table_impl(
self,
*,
version_table: str,
version_table_schema: Optional[str],
version_table_pk: bool,
**kw,
) -> Table:
return Table(
"alembic_version",
MetaData(),
Column("id", BIGINT, autoincrement=True, primary_key=True),
Column("version_num", VARCHAR(32), primary_key=False),
starrocks_primary_key="id",
)

Loading