-
Notifications
You must be signed in to change notification settings - Fork 22
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
Pugsql chokes on normal comments interspersed in the sql file #62
Comments
Can you paste a query that fails? |
Hi, thanks for your quick response. This was my first time trying to use pugsql so maybe I am just doing something wrong. But here is my failing query file: -- pugsql seems to choke on a single-line comment as well -- :name greet :one -- :name get_user_42 :one -- :name get_user_with_id :one |
Adding the following lines to the head of the above file seems to satisfy pugsql: :name dummy_query :one |
I have edited the description of the error to be more accurate |
I see, currently pugsql needs the metadata for the query (the --- not metadata
--- :name foo
select 1; but not: --- not metadata
--- :name foo
select 1; We should resolve that (probably backwards compatible with how it works now) so that it's no longer whitespace significant. I could see also supporting a There are probably also some ways the error messages could be more helpful here. |
pugsql raises the following error if there are any normal comments in the sql code (unless they are between the :name special comment and the actual sql query.
ValueError: Statement must have a name.
Is this the correct behaviour? Would it not be desirable to be able to comment out sections of the sql file or add section comments etc?
The text was updated successfully, but these errors were encountered: