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

MSSQL DDLs with '[]' #28

Closed
xnuinside opened this issue Oct 10, 2021 · 1 comment
Closed

MSSQL DDLs with '[]' #28

xnuinside opened this issue Oct 10, 2021 · 1 comment

Comments

@xnuinside
Copy link
Owner

Describe the bug
Right now this code:

"""CREATE TABLE [dbo].[users_WorkSchedule](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [RequestDropDate] [smalldatetime] NULL,
        [ShiftClass] [varchar](5) NULL,
        [StartHistory] [datetime2](7) GENERATED ALWAYS AS ROW START NOT NULL,
        [EndHistory] [datetime2](7) GENERATED ALWAYS AS ROW END NOT NULL,
        CONSTRAINT [PK_users_WorkSchedule_id] PRIMARY KEY CLUSTERED
        (
            [id] ASC
        )
        WITH (
            PAD_INDEX = OFF,
            STATISTICS_NORECOMPUTE = OFF,
            IGNORE_DUP_KEY = OFF,
            ALLOW_ROW_LOCKS = ON,
            ALLOW_PAGE_LOCKS = ON
        )  ON [PRIMARY],
        PERIOD FOR SYSTEM_TIME ([StartHistory], [EndHistory])
    )
  """

produces models like:

from gino import Gino
from sqlalchemy.dialects.postgresql import ARRAY

db = Gino(schema="[dbo]")


class [users_WorkSchedule](db.Model):

    __tablename__ = '[users_WorkSchedule]'

    [id] = db.Column(ARRAY((1,1)), nullable=False)
    [RequestDropDate] = db.Column(ARRAY(()))
    [ShiftClass] = db.Column(ARRAY((5)))
    [StartHistory] = db.Column(ARRAY((7)), nullable=False)
    [EndHistory] = db.Column(ARRAY((7)), nullable=False)

need to remove [] from types, tables, columns names & etc before generate code based on metadata from DDL

@xnuinside
Copy link
Owner Author

fixed in 0.11.0 version

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

No branches or pull requests

1 participant