Daniel McLaury
Daniel McLaury

Reputation: 4293

Generate a table with columns using multiple encodings

In e.g. mysql you can do something like

CREATE TABLE tags
(
  tag_name VARCHAR(10)  CHARACTER SET latin1,
  tag_desc VARCHAR(140) CHARACTER SET utf8mb4
);

Is there any way to get SQLAlchemy to generate a table like this?

Upvotes: 1

Views: 32

Answers (1)

Daniel McLaury
Daniel McLaury

Reputation: 4293

I was actually able to figure this out myself. Instead of using the generic types like

sqlalchemy.types.String(length = 10)

I just have to use

sqlalchemy.dialects.mysql.VARCHAR(length = 10, charset = 'latin1')

Upvotes: 1

Related Questions