-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
I would like to create executable scripts using datafusion-cli as an interpreter.
For example, given the following tmp.sql file:
#!/usr/bin/env -S datafusion-cli -f
SELECT 1;
I would like to be able to run the following successfully:
$ chmod 755 tmp.sql
$ ./tmp.sql
Instead, I get this:
$ chmod 755 tmp.sql
$ ./tmp.sql
DataFusion CLI v40.0.0
SQL error: ParserError("Expected an SQL statement, found: #!")
$
Describe the solution you'd like
When datafusion-cli is run on a file it should ignore the first line of the file if it begins with '#!' as the first two characters.
I believe no valid SQL file can begin with '#!'. Therefore it is safe to make this rule. If for some reason someone wanted to begin a statement with #!, they can put a return at the beginning of the file. '#!' must be the first two characters of the file to be a valid hashbang.
Describe alternatives you've considered
No response
Additional context
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request