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

Assertion error with BigQuery when running .pql scripts but not REPL #39

Open
dimitri-b opened this issue Aug 29, 2021 · 1 comment
Open

Comments

@dimitri-b
Copy link

Running the following (or any other) script with preql -m foo command:

connect("bigquery:///gcp-project-id-here")

cal = import_table("test_data.temp_cal")
print(cal)

Results in the correct execution (judging by the output) but an assertion error afterwards. Doing the same in REPL works without any errors.

(INFO) state -- [Preql] Connecting to bigquery:///gcp-project-id-here
                         table temp_cal =5
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Fin_Year ┃ Fin_Year_Label ┃ id                                   ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│     2016 │ FY16           │ 1849f81a-51c6-4135-ac16-120d2e5a92fd │
│     2016 │ FY16           │ bf20059c-7089-4b7b-a0df-a583d3a7fad9 │
│     2016 │ FY16           │ 158140c2-9228-49a2-90e6-a44aafd7f9c5 │
│     2016 │ FY16           │ ea7f8b5b-8f80-4b56-9f97-4cdd5a26105a │
│     2016 │ FY16           │ 9b6abcc5-6da7-4d9d-923b-84e7d33e311e │
└──────────┴────────────────┴──────────────────────────────────────┘

Traceback (most recent call last):
  File "/PyCharmVenv/PreQL/bin/preql", line 8, in <module>
    sys.exit(main())
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/__main__.py", line 76, in main
    p('import ' + args.module)
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/api.py", line 25, in inner
    return f(*args, **kwargs)
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/api.py", line 197, in __call__
    res = self._run_code(code, '<inline>', args)
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/api.py", line 193, in _run_code
    return self._interp.execute_code(code + "\n", source_name, pql_args)
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/core/interpreter.py", line 36, in inner
    return f(interp, *args, **kwargs)
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/core/interpreter.py", line 86, in _execute_code
    last = execute(stmt)
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/core/evaluate.py", line 383, in execute
    return stmt._execute() or objects.null
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/core/evaluate.py", line 364, in _execute
    module = import_module(context.state, r)
  File "/PyCharmVenv/PreQL/lib/python3.9/site-packages/preql/core/evaluate.py", line 355, in import_module
    assert state.db is i.state.db
AssertionError
@erezsh
Copy link
Owner

erezsh commented Aug 30, 2021

Yes, my bad, sorry!

I pushed a fix to the schemas branch.

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

2 participants