jasondcamp / pyway

A Flyway like migration manager written in python.
GNU General Public License v3.0
21 stars 12 forks source link

Use `cursor.executescript` for sqlite #68

Closed jmpicnic closed 1 month ago

jmpicnic commented 1 month ago

When executing a migration with a file that contains more than one sql statement against sqlite, it gives an exception:

sqlite3.ProgrammingError: You can only execute one statement at a time.

Looking at the code, it seems that sqlite.py in line 40 is calling cursor.execute(script).

To support files with multiple statements with sqlite the call should be cursor.executescript(script)

Created fork and pull request with the change in case it helps. See the PR here

jmpicnic commented 1 month ago

@jasondcamp I am not sure you saw this issue yet with the PR I created to try to help. Please let me know if there are other questions or issues with the PR.

Thanks

Miguel

jasondcamp commented 1 month ago

Thank you for this PR! Merged and I'll cut a new release today.

jmpicnic commented 1 month ago

Awesome, thanks a lot!

Miguel


Miguel Pinilla www.linkedin.com/in/mpinilla/ +1-650.489.0329

See my book at Amazon: https://amazon.com/author/miguel.pinilla

On Thu, Aug 1, 2024 at 6:19 AM Jason Camp @.***> wrote:

Thank you for this PR! Merged and I'll cut a new release today.

— Reply to this email directly, view it on GitHub https://github.com/jasondcamp/pyway/issues/68#issuecomment-2263023065, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABAQA7KJGIZQUA3SISV4FVLZPIYVNAVCNFSM6AAAAABLPCE4P6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRTGAZDGMBWGU . You are receiving this because you authored the thread.Message ID: @.***>