Invalid SessionHandle

Open
#394 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, sqlalchemy
Domain
database

Research direction

Begin with the SQLAlchemy engine setup and n_engine.connect() example in the issue, then reproduce the delayed query using the listed Hive connection settings. Determine what happens when the session expires between connections and identify the relevant PyHive entry point or test; the issue names no repository files or completion criteria.

Written by the indexing model from the issue text.

Description

Hello,

I'm using pyhive with sqlAlchemy in my web application to to fetch data from hive, at first my queries seem to work just fine but after I leave it for a while and then try to run a query again I get the following error
"Internal server error (pyhive.exc.OperationalError) TExecuteStatementResp(status=TStatus(statusCode=3, infoMessages=['*org.apache.hive.service.cli.HiveSQLException: Invalid SessionHandle: SessionHandle [2ad56f2d-ff50-4266-885f-599341ca56b5]:12:11', 'org.apache.hive.service.cli.session.SessionManager:getSession:SessionManager.java:475',

Here is a sample of my code

from sqlalchemy import create_engine
import backend.settings as S

n_engine = create_engine(
    f"hive://{S.HIVE_SERVER}:{S.HIVE_PORT}/{S.HIVE_DB_NLP}",
    connect_args={"auth": S.HIVE_AUTH},
)
from core.databases import n_engine

with n_engine.connect() as conn:
    query = """
        SELECT 
            *
        FROM most_frequent_words 
        WHERE 1 = 1 """
    result_set = conn.execute(query)
    result = result_set.mappings().all()

Is this some sort of a timeout error or am I doing something wrong here

Dominant language
Python
Stars
1.7k
Forks
545
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dropbox/PyHive

All issues in dropbox/PyHive

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.