Build table-level CREATE options like ENGINE and COLLATE.
(self, table: sa_schema.Table)
| 2115 | return " ".join(colspec) |
| 2116 | |
| 2117 | def post_create_table(self, table: sa_schema.Table) -> str: |
| 2118 | """Build table-level CREATE options like ENGINE and COLLATE.""" |
| 2119 | |
| 2120 | table_opts = [] |
| 2121 | |
| 2122 | opts = { |
| 2123 | k[len(self.dialect.name) + 1 :].upper(): v |
| 2124 | for k, v in table.kwargs.items() |
| 2125 | if k.startswith("%s_" % self.dialect.name) |
| 2126 | } |
| 2127 | |
| 2128 | if table.comment is not None: |
| 2129 | opts["COMMENT"] = table.comment |
| 2130 | |
| 2131 | partition_options = [ |
| 2132 | "PARTITION_BY", |
| 2133 | "PARTITIONS", |
| 2134 | "SUBPARTITIONS", |
| 2135 | "SUBPARTITION_BY", |
| 2136 | ] |
| 2137 | |
| 2138 | nonpart_options = set(opts).difference(partition_options) |
| 2139 | part_options = set(opts).intersection(partition_options) |
| 2140 | |
| 2141 | for opt in topological.sort( |
| 2142 | [ |
| 2143 | ("DEFAULT_CHARSET", "COLLATE"), |
| 2144 | ("DEFAULT_CHARACTER_SET", "COLLATE"), |
| 2145 | ("CHARSET", "COLLATE"), |
| 2146 | ("CHARACTER_SET", "COLLATE"), |
| 2147 | ], |
| 2148 | nonpart_options, |
| 2149 | ): |
| 2150 | arg = opts[opt] |
| 2151 | if opt in _reflection._options_of_type_string: |
| 2152 | arg = self.sql_compiler.render_literal_value( |
| 2153 | arg, sqltypes.String() |
| 2154 | ) |
| 2155 | |
| 2156 | if opt in ( |
| 2157 | "DATA_DIRECTORY", |
| 2158 | "INDEX_DIRECTORY", |
| 2159 | "DEFAULT_CHARACTER_SET", |
| 2160 | "CHARACTER_SET", |
| 2161 | "DEFAULT_CHARSET", |
| 2162 | "DEFAULT_COLLATE", |
| 2163 | ): |
| 2164 | opt = opt.replace("_", " ") |
| 2165 | |
| 2166 | joiner = "=" |
| 2167 | if opt in ( |
| 2168 | "TABLESPACE", |
| 2169 | "DEFAULT CHARACTER SET", |
| 2170 | "CHARACTER SET", |
| 2171 | "COLLATE", |
| 2172 | ): |
| 2173 | joiner = " " |
| 2174 |
nothing calls this directly
no test coverage detected