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

Update index.md #12

Merged
merged 1 commit into from
Jun 11, 2019
Merged

Update index.md #12

merged 1 commit into from
Jun 11, 2019

Conversation

danielk-bud
Copy link
Contributor

If the leading comment begins with three dashes as shown in the example, I get a ValueError: Statement must have a name. error.

Not sure how to fix it in the lexer so I just thought I'd update the docs and leave this as a note that there's "something up with it". :)

PugSQL Version: 0.1.9

Query file:

--- :name customer_total :one
SELECT
  COUNT(DISTINCT user_id) users
FROM
  transactions

Stack Trace:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/main.py", line 306, in run
    loop.run_until_complete(self.serve(sockets=sockets))
  File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/main.py", line 313, in serve
    config.load()
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/config.py", line 182, in load
    self.loaded_app = import_from_string(self.app)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/importer.py", line 20, in import_from_string
    module = importlib.import_module(module_str)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./app.py", line 30, in <module>
    db = pugsql.module('queries/')
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/__init__.py", line 35, in module
    return compiler._module(sqlpath)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/compiler.py", line 151, in _module
    modules[sqlpath] = Module(sqlpath)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/compiler.py", line 45, in __init__
    s = parser.parse(pugsql, ctx=context.Context(sqlfile))
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/parser.py", line 38, in parse
    filename=ctx.sqlfile if ctx.sqlfile != '<literal>' else None)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/statement.py", line 68, in __init__
    raise ValueError('Statement must have a name.')
ValueError: Statement must have a name.

If the leading comment begins with three dashes as shown in the example, I get a `ValueError: Statement must have a name.` error.

Not sure how to fix it in the lexer so I just thought I'd update the docs and leave this as a note that there's "something up with it". :)

PugSQL Version: `0.1.9`

Query file:
```
--- :name customer_total :one
SELECT
  COUNT(DISTINCT user_id) users
FROM
  transactions
```

Stack Trace:
```
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/main.py", line 306, in run
    loop.run_until_complete(self.serve(sockets=sockets))
  File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/main.py", line 313, in serve
    config.load()
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/config.py", line 182, in load
    self.loaded_app = import_from_string(self.app)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/uvicorn/importer.py", line 20, in import_from_string
    module = importlib.import_module(module_str)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./app.py", line 30, in <module>
    db = pugsql.module('queries/')
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/__init__.py", line 35, in module
    return compiler._module(sqlpath)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/compiler.py", line 151, in _module
    modules[sqlpath] = Module(sqlpath)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/compiler.py", line 45, in __init__
    s = parser.parse(pugsql, ctx=context.Context(sqlfile))
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/parser.py", line 38, in parse
    filename=ctx.sqlfile if ctx.sqlfile != '<literal>' else None)
  File "/home/daniel/.local/share/virtualenvs/myproject-bUWJ7r0D/lib/python3.6/site-packages/pugsql/statement.py", line 68, in __init__
    raise ValueError('Statement must have a name.')
ValueError: Statement must have a name.
```
@mcfunley
Copy link
Owner

Awesome thank you, I made #13 to look into the underlying problem.

@mcfunley mcfunley merged commit d075797 into mcfunley:master Jun 11, 2019
@danielk-bud
Copy link
Contributor Author

Happy to help. :)

@danielk-bud danielk-bud deleted the patch-1 branch June 12, 2019 09:45
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

Successfully merging this pull request may close these issues.

2 participants