andreossido / laravel-odbc

ODBC integration for Laravel framework
35 stars 29 forks source link

SYNTAX_ERROR: line 1:1: Incorrect number of parameters: expected 1 but found 0 #2

Closed carcinocron closed 5 years ago

carcinocron commented 5 years ago
Illuminate\Database\QueryException: PHP Warning:  odbc_prepare(): SQL error: [Simba][Athena] (1040) An error has been thrown from the AWS Athena client. Athena Error No: 102, HTTP Response Code: 1, Error Message: SYNTAX_ERROR: line 1:1: Incorrect number of parameters: expected 1 but found 0 [Execution ID: <redacted>], SQL state 37000 in SQLPrepare in /home/forge/app/vendor/abram/laravel-odbc/src/ODBCPdoStatement.php on line 28 (SQL: select * from "qa_lines_csv" where "id" > 100 limit 1) in /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
Stack trace:
#0 /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback('select * from "...', Array, Object(Closure))
#1 /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\Database\Connection->run('select * from "...', Array, Object(Closure))
#2 /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2095): Illuminate\Database\Connection->select('select * from "...', Array, true)
#3 /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2083): Illuminate\Database\Query\Builder->runSelect()
#4 /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2569): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2084): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /home/forge/app/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(77): Illuminate\Database\Query\Builder->get(Array)
#7 /home/forge/app/vendor/psy/psysh/src/ExecutionLoopClosure.php(55) : eval()'d code(2): Illuminate\Database\Query\Builder->first()
#8 /home/forge/app/vendor/psy/psysh/src/ExecutionLoopClosure.php(55): eval()
#9 /home/forge/app/vendor/psy/psysh/src/ExecutionClosure.php(101): Psy\{closure}()
#10 /home/forge/app/vendor/psy/psysh/src/ExecutionLoop.php(33): Psy\ExecutionClosure->execute()
#11 /home/forge/app/vendor/psy/psysh/src/Shell.php(351): Psy\ExecutionLoop->run(Object(Psy\Shell))
#12 /home/forge/app/vendor/symfony/console/Application.php(145): Psy\Shell->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Psy\Output\ShellOutput))
#13 /home/forge/app/vendor/psy/psysh/src/Shell.php(316): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Psy\Output\ShellOutput))
#14 /home/forge/app/vendor/laravel/tinker/src/Console/TinkerCommand.php(62): Psy\Shell->run()
#15 [internal function]: Laravel\Tinker\Console\TinkerCommand->handle()
#16 /home/forge/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#17 /home/forge/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#18 /home/forge/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#19 /home/forge/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(572): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#20 /home/forge/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#21 /home/forge/app/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#22 /home/forge/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#23 /home/forge/app/vendor/symfony/console/Application.php(901): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /home/forge/app/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Laravel\Tinker\Console\TinkerCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /home/forge/app/vendor/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /home/forge/app/vendor/laravel/framework/src/Illuminate/Console/Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/forge/app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/forge/app/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

when attempting to run:

DB::connection('test_athena')->table('qa_lines_csv')->where('id', '>', 100)->first()

When looking at the source code, my best guess is that this library only supports :named parameters, but not ? parameters, or that it's not yet supporting parameters in general.

carcinocron commented 5 years ago

Might be caused by this instead of this library: https://stackoverflow.com/a/50825768

andreossido commented 5 years ago

Sorry for late reply. Can I close the issue? Or maybe can I help you to resolve?

carcinocron commented 5 years ago

I verified that AWS Athena doesn't support prepared statements (so I have no idea how anyone is actually using it). DB::unprepared works but I can't rewrite large parts of my app to be unsecure just for this.