-
Notifications
You must be signed in to change notification settings - Fork 32
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
Query returns empty result set #232
Comments
Hi @iaxentoi! Can you please share your exact script? Thank you! |
hi, here is the script: const { DBSQLClient, DBSQLLogger, LogLevel } = require("@databricks/sql");
const serverHostname = "xxxx";
const httpPath = "xxxx";
const token = "secret";
if (!token || !serverHostname || !httpPath) {
throw new Error(
"Cannot find Server Hostname, HTTP Path, or " +
"personal access token. " +
"Check the environment variables DATABRICKS_SERVER_HOSTNAME, " +
"DATABRICKS_HTTP_PATH, and DATABRICKS_TOKEN."
);
}
const client = new DBSQLClient({
logger: new DBSQLLogger({level: LogLevel.debug })
});
const connectOptions = {
token: token,
host: serverHostname,
path: httpPath,
};
client
.connect(connectOptions)
.then(async (client) => {
const session = await client.openSession();
console.log(`Running query`);
const queryOperation = await session.executeStatement(
'select "Hello"',
{
runAsync: true,
maxRows: 10000, // This option enables the direct results feature.
}
);
const result = await queryOperation.fetchAll();
await queryOperation.close();
console.log(result);
await session.close();
await client.close();
})
.catch((error) => {
console.log(error);
}); Actually when switching to another server it works fine, so might some kind of permissions/access issue. |
Hi @kravets-levko, after some investigation this seems to be related to the Databricks runtime version.
The processing can be seen on Databricks side and the results to be returned, but that is not picked up by the node client and an empty result set is returned instead. |
Hi @iaxentoi! Thank you for you replies. It's really great that you managet to localize the issue - now I know where to start with debugging. At the same time, it's weird because the library should throw an error on unsupported result formats, so very likely there's something wrong there. I'll try to reproduce this behavior and let you know. Also, can you try other conectors if possible (Python/Go)? I'm curious if thir behavior is the same or different. Thank you! P.S. Your script looks good, I see nothing wrong with it |
Yes, tried with Python and it works fine. |
|
Trying to run the example code from https://docs.databricks.com/en/dev-tools/nodejs-sql-driver.html#language-JavaScript
I am using the personal token method but every query returns an empty array.
I also enabled debug level logging and seems to be no error ar anything strange:
Running on MacOS using node v18.18.2.
The text was updated successfully, but these errors were encountered: