Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

TypeError when using Enum columns with the Databricks dialect (all 2.0.x releases)

Open Beginner friendly
#61 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python, sqlalchemy
Domain
databases

Research direction

Start with DatabricksStringType and follow SQLAlchemy's Enum.adapt() path described in the issue. Run the provided DeclarativeBase reproduction against a Databricks engine, then verify that creating metadata with the Enum column completes without the _enums TypeError.

Written by the indexing model from the issue text.

Description

Description

Any SQLAlchemy operation that involves an Enum-typed column with the Databricks dialect raises:

TypeError: String.__init__() got an unexpected keyword argument '_enums'

Steps to reproduce

 from sqlalchemy import create_engine, Column, Enum
 from sqlalchemy.orm import DeclarativeBase
 
 class Base(DeclarativeBase):
     pass
 
 class MyTable(Base):
     __tablename__ = "my_table"
     status = Column(Enum("A", "B", "C"), nullable=False)
 
 engine = create_engine("databricks://...")
 Base.metadata.create_all(engine)

Root cause

databricks-sqlalchemy registers DatabricksStringType as the colspec for sqlalchemy.String in the Databricks dialect. When SQLAlchemy adapts an Enum column (via Enum.adapt()), it internally passes _enums as a keyword argument to the target type's constructor. DatabricksStringType.__init__() does not accept **kwargs or _enums, causing the crash.

Environment

Affected versions: 2.0.1 – 2.0.9
SQLAlchemy: 2.0.x

Related issues

  • #32 - No JSON colspec, CompileError at DDL compile time
  • #37 - No INTERVAL colspec, Silent missing feature
  • This issue - Enum colspec exists but target class rejects _enums kwarg
Dominant language
Python
Stars
24
Forks
18
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databricks/databricks-sqlalchemy

All issues in databricks/databricks-sqlalchemy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.