Recent searches
No recent searches

BL Data
Joined Nov 30, 2022
·
Last activity Mar 31, 2023
Following
0
Follower
1
Total activity
7
Votes
2
Subscriptions
2
ACTIVITY OVERVIEW
BADGES
ARTICLES
POSTS
COMMUNITY COMMENTS
ARTICLE COMMENTS
ACTIVITY OVERVIEW
Latest activity by BL Data
BL Data commented,
Hi, thank you for your reply.
I'm not looking to avoid the standard hosting services, I just wanted to be aware of all available options for my implementation.
Thank you!
View comment · Posted Mar 31, 2023 · BL Data
0
Followers
0
Votes
0
Comments
BL Data created a post,
I am working on a server-side app using the React scaffold. I used the Event Timeline app example from here as a starting point. So my app.js code is very similar to that example.
While testing, I have also successfully displayed sample data from my Databricks SQL warehouse into my Zendesk app. The following is some code I am using in my backend.js file to get that data from Databricks:
const express = require('express');
const { DBSQLClient } = require('@databricks/sql');
const cors = require('cors');
const app = express();
const port = process.env.PORT || 3000;
const corsOptions = {
origin: 'http://localhost:4567'
}
app.use(cors(corsOptions));
var token = process.env.DATABRICKS_TOKEN;
var serverHostname = process.env.DATABRICKS_SERVER_HOSTNAME;
var httpPath = process.env.DATABRICKS_HTTP_PATH;
if (!token || !serverHostname || !httpPath) {
throw new Error("Cannot find Server Hostname, HTTP Path, or personal access token. " +
"Check the environment variables DATABRICKS_TOKEN, " +
"DATABRICKS_SERVER_HOSTNAME, and DATABRICKS_HTTP_PATH.");
}
const client = new DBSQLClient();
app.get('/api/query', async (req, res) => {
try {
await client.connect({
token: token,
host: serverHostname,
path: httpPath
});
const session = await client.openSession();
const queryOperation = await session.executeStatement(
statement = `SELECT fare_amount FROM samples.nyctaxi.trips LIMIT 3`,
options = {
runAsync: true,
maxRows: 10000 // This option enables the direct results feature.
}
);
... // other code here
});
app.listen(port, () => {
console.log(`Server started on port ${port}`);
});
In my frontend (app.js), I make a GET request to the endpoint here in my backend.js (http://localhost:3000/api/query) and the results of the SQL query are fetched and displayed in my Zendesk App.
If my understanding is correct, I can host the backend part of my app in AWS, Heroku or a similar service.
My question is, could I host the backend in Zendesk instead? If so, how would I implement and configure this?
Also, if I should edit some part of my code to implement this, please provide an example or suggestion.
Edited Mar 29, 2023 · BL Data
0
Followers
4
Votes
3
Comments
BL Data created a post,
We are working on a project that would involve integrating data into Zendesk from Databricks.
How would I make this integration possible?
Edited Nov 30, 2022 · BL Data
1
Follower
4
Votes
3
Comments