Comments (3)
Hi @timtucker-dte! So:
- client instance can be safely used as singleton. Probably the only advice here could be to have an instance per connection options set (host + path + auth creds - things you pass to
client.connect()
). Depending on your use case, you may callconnect()
many times on same client, passing different options, but you'd have to close client before second and subsequentconnect
calls. - session could also be used as a singleton, but keep in mind that after some period of inactivity it will expire and you'll start getting error on any operation running against the session.
Both client and session objects should eventually be closed to free up resources they use. When you do this depends on your use case. Client instance itself doesn't expire, and can be used as long as you need. Sessions (as mentioned) will expire if not used. So if, for example, your code executes some queries frequently it makes sense to keep and re-use session object - it will save some time and network requests. If your script runs, say, every hour, - it's better to create a new session each time and close it when script finishes, so you don't have to deal with expired sessions.
Hope this clarifies things a bit, but feel free to ask if any questions
from databricks-sql-nodejs.
Thanks!
For a session, how would we tell that it's expired?
Is there an event that we should be listening for / an error that we can catch?
Is there a good way to tell whether or not a session currently has operations pending?
Ideally what we're looking for is the equivalent of what we can get using connection pooling libraries with other SDKs, where most of the object management gets taken care of automatically behind the scenes.
from databricks-sql-nodejs.
For a session, how would we tell that it's expired?
We cannot until we try to use it. It's a big problem for developers of all connectors, and we don't have anh solution for this so far.
Is there an event that we should be listening for / an error that we can catch?
I need to double-check, but if I recall correctly - you'll just get a HTTP 404 when trying to use an expired session
Is there a good way to tell whether or not a session currently has operations pending?
I'm curiour what's a use case for it?
from databricks-sql-nodejs.
Related Issues (20)
- Does this library support Azure Managed Service Identities for authentication? HOT 3
- Documentation on timeout options needs clarification HOT 13
- ERROR -- TProtocolException: Server version doesn't support parametrized queries HOT 6
- nulls are returned as 0s HOT 5
- Cast exception for column type = binary HOT 3
- EventEmitter leaks when many `IDBSQLClient` objects are created HOT 2
- Allow setting TLS settings on the underlying HTTPS agent
- databricks : FetchError due to Premature close! HOT 7
- HiveDriverError: The session was closed or has expired HOT 2
- Using named parameters with Azure Databricks? HOT 13
- UNBOUND_SQL_PARAMETER error when using ordinal query parameters HOT 6
- Running into invoke error using lambda and nodejs 18 HOT 7
- invalid_scope in DBSQLClient HOT 4
- Query returns empty result set HOT 6
- Inconsistent Row Count in SQL Query Results HOT 1
- Issue with Databricks Making Requests to Unavailable URL Through Squid Proxy HOT 13
- Error When Freezing Array.prototype HOT 2
- lz4 dependency is causing install issues for our users HOT 8
- Add support for results streaming HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from databricks-sql-nodejs.