Open c0dearm opened 6 months ago
Hey @c0dearm 👋🏻
Can you provide a small example (SQLAlchemy) schema that reproduces this issue?
I could test in local that with version 0.1.5
there is no problems but starting from 0.2.0
it sometimes fails...
there is definitely something there
@bonastreyair can you share small example that is not working and your sqlalchemy version?
I tried to reproduce the issue with no success with this schema:
from sqlalchemy import create_engine, Column, Integer, String, Enum
from sqlalchemy.ext.declarative import declarative_base
import enum
Base = declarative_base()
# Define the Enum types
class LogLevelEnum(enum.Enum):
DEBUG = 'DEBUG'
INFO = 'INFO'
WARNING = 'WARNING'
ERROR = 'ERROR'
CRITICAL = 'CRITICAL'
class JobStatusEnum(enum.Enum):
CREATED = 'CREATED'
QUEUED = 'QUEUED'
RUNNING = 'RUNNING'
SUCCESSFUL = 'SUCCESSFUL'
FAILED = 'FAILED'
CANCELLED = 'CANCELLED'
class OperationStatusEnum(enum.Enum):
SUBMITTED = 'SUBMITTED'
PREPARING = 'PREPARING'
AVAILABLE = 'AVAILABLE'
INVALID = 'INVALID'
# Example model using the enums
class ExampleModel(Base):
__tablename__ = 'example_model'
id = Column(Integer, primary_key=True)
log_level = Column(Enum(LogLevelEnum), default=LogLevelEnum.INFO)
job_status = Column(Enum(JobStatusEnum))
operation_status = Column(Enum(OperationStatusEnum))
those are my installed packages:
(env) ➜ test-alchemy pip list
Package Version
------------------------- -------
atlas-provider-sqlalchemy 0.2.0
click 8.1.7
greenlet 3.0.3
markdown-it-py 3.0.0
mdurl 0.1.2
pip 23.3.2
Pygments 2.18.0
rich 13.7.1
setuptools 69.0.3
shellingham 1.5.4
SQLAlchemy 2.0.30
typer 0.12.3
typing_extensions 4.12.0
wheel 0.42.0
This is some strange behavior, it can be seen in the following screenshot:
As you can observe, sometimes, the very first runs of the command don't output anything, until at some point it prints the correct SQL sentences. No modification was done to any of the SQLAlchemy models between the different executions. I am not sure if this is something related to the particularities of my project or if it is consistent across other projects. Let me know if you need more details.
This inconsistency is quite annoying, since when the output is empty the migration generated by Atlas is basically to drop everything 😱