Hi team, I am looking for Starrocks Sqlalchemy fe...
# questions-and-troubleshooting
t
Hi team, I am looking for Starrocks Sqlalchemy features, where it would allow me to declare
PARTITION BY
or
ORDER BY
clause in table creation, in an ORM model. Could someone share an example with me. Or show me where the source code is? (currently the link on pypi https://pypi.org/project/starrocks/ directs to the source code of starrocks itself)
From the local version, i can see these two clauses are not supported yet, could someone show me where the source code it, i could contribute
Copy code
def post_create_table(self, table):
        """Build table-level CREATE options like ENGINE and COLLATE."""

        table_opts = []

        opts = dict(
            (k[len(self.dialect.name) + 1 :].upper(), v)
            for k, v in table.kwargs.items()
            if k.startswith("%s_" % self.dialect.name)
        )

        if table.comment is not None:
            opts["COMMENT"] = table.comment


        if 'ENGINE' in opts:
            table_opts.append(f'ENGINE={opts["ENGINE"]}')

        if 'PRIMARY_KEY' in opts:
            table_opts.append(f'PRIMARY KEY({opts["PRIMARY_KEY"]})')

        if 'DISTRIBUTED_BY' in opts:
            table_opts.append(f'DISTRIBUTED BY HASH({opts["DISTRIBUTED_BY"]})')

        if "COMMENT" in opts:
            comment = self.sql_compiler.render_literal_value(
                opts["COMMENT"], sqltypes.String()
            )
            table_opts.append(f"COMMENT {comment}")

        # ToDo - Partition
        # ToDo - Distribution
        # ToDo - Order by

        if "PROPERTIES" in opts:
            props = ",\n".join([f'\t"{k}"="{v}"' for k, v in opts["PROPERTIES"]])
            table_opts.append(f"PROPERTIES(\n{props}\n)")