Skip to content

Offline migration special characters are not translated properly. #1449

Closed Answered by le0nce
le0nce asked this question in Usage Questions
Discussion options

You must be logged in to vote

I solved the issue with modifing the run_migrations_offline in env.py:

Added buffer:

    buffer = io.StringIO()

    context.configure(
        url=url,
        target_metadata=target_metadata,
        literal_binds=True,
        dialect_opts={"paramstyle": "named"},
        output_buffer=buffer
    ) 

Wrote output manually

    output = buffer.getvalue()
    print(output)

    with open(f"sql_scripts\\{revision_id}_deployment.sql", "w", encoding="utf-8") as f:
        f.write(output)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by le0nce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants