Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes atlas-provider-sqlalchemy outputs nothing #16

Open
c0dearm opened this issue May 24, 2024 · 3 comments
Open

Sometimes atlas-provider-sqlalchemy outputs nothing #16

c0dearm opened this issue May 24, 2024 · 3 comments
Assignees

Comments

@c0dearm
Copy link

c0dearm commented May 24, 2024

This is some strange behavior, it can be seen in the following screenshot:
Screenshot 2024-05-24 171228

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 😱

@a8m
Copy link
Member

a8m commented May 24, 2024

Hey @c0dearm 👋🏻

Can you provide a small example (SQLAlchemy) schema that reproduces this issue?

@bonastreyair
Copy link

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

@ronenlu
Copy link
Member

ronenlu commented May 27, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants