It looks like SQLAlchemy defaults to creating VARCHAR2 columns as CHAR. How can I have it create with BYTE instead?
from sqlalchemy import MetaData, Column, String from sqlalchemy.ext.declarative import declarative_base metadata = MetaData() Base = declarative_base(metadata=metadata) class Foo(Base): __tablename__ = 'foo' name = Column(String(10), primary_key=True) Foo.__table__.create(bind=engine)
This creates the following table:
CREATE TABLE XXMD.FOO ( NAME VARCHAR2(10 CHAR) NOT NULL )
Instead, I would like it to create the following:
CREATE TABLE XXMD.FOO ( NAME VARCHAR2(10 BYTE) NOT NULL )
I would prefer to use CHAR, but I'm integrating with a few systems whose table's are BYTE and need my corresponding tables to match theirs.
We also have some tables/code that are reliant on Oracle's data dictionary which use BYTE instead of CHAR.
I've tried using sqlalchemy.dialects.oracle.VARCHAR2, but it also defaults to CHAR.
Best regards,
Matthew Moisen
---
I'm using SQLAlchemy 1.1.5, cx_Oracle 5.3, an Oracle 12CR1 Client, and an Oracle 12CR1 DB.