Python sqlite3 success on local, but failed on Github Action

Viewed 806

Same python version, same sqlite3 version, and same file, but I just cannot pass in Github Action.

here is my github action: https://github.com/CloudAurora/Blog/blob/master/.github/workflows/main.yml

and my python file: https://github.com/CloudAurora/Blog/blob/master/scripts/init_database.py

I can run this file successfully in my local linux machine:

Projects/Blog - [master●] » python scripts/init_database.py -r ./posts --token  xxx
sqlite version 2.6.0
INSERT_USER_STATEMENT 
    INSERT INTO User(bio, email, githubId, name)
    VALUES(?,?,?,?)
    ON CONFLICT(name) DO NOTHING

INSERT_USER_STATEMENT 
    INSERT INTO User(bio, email, githubId, name)
    VALUES(?,?,?,?)
    ON CONFLICT(name) DO NOTHING

Create db file in: ./prisma/dev.db, and env is set

But, when I push it to github, it will fail in Github Action:

 sqlite version 2.6.0
INSERT_USER_STATEMENT 
    INSERT INTO User(bio, email, githubId, name)
    VALUES(?,?,?,?)
    ON CONFLICT(name) DO NOTHING

Traceback (most recent call last):
  File "scripts/init_database.py", line 110, in <module>
    c.execute(INSERT_USER_STATEMENT, author_info)
sqlite3.OperationalError: near "ON": syntax error
##[error]Process completed with exit code 1.

you can find the full logs: https://github.com/CloudAurora/Blog/runs/899163805?check_suite_focus=true

1 Answers

What fixed a similar SQLite problem for me is in my YAML workflow, replacing

runs-on: ubuntu-latest 

with

runs-on: ubuntu-20.04

ubuntu-latest uses Ubuntu 18.04 and the SQLite version seems to be old and have an issue.

Related