druid-io / pydruid

A Python connector for Druid
Other
506 stars 194 forks source link

urlopen error [WinError 10054] : Pydruid connection error wile fetching data through client on Imply druid #259

Open soumonos opened 3 years ago

soumonos commented 3 years ago

I am trying to connect to my enterprise druid console through pydruid. A sample code follows as:

import numpy as np
import pandas as pd
import json
from pydruid import *
from pydruid.client import *
from pylab import plt
from pydruid.query import QueryBuilder
from pydruid.utils.postaggregator import *
from pydruid.utils.aggregators import *
from pydruid.utils.filters import *
client= PyDruid(url= 'https://imply****************** :**88', 
                endpoint='druid/v2')
client.set_basic_auth_credentials(username= "admin", password= "**Password" )
pulled_data= client.timeseries(
            datasource= '**datasource1',
            granularity='day',
            intervals= "2020-02-27T09:00:00.000Z/2020-05-27T09:00:00.000Z",
            filter = Dimension('Event_type')=='**event1')
.......

I have tried both with and without setting basic_auth_credentials The url , endpoint, and credentials are from my Imply druid cluster API documentation.

The error I get:

URLError: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>

Suggestions would be helpful.

afghani-iitkgp commented 1 year ago

Have you used any Query Context param? Try send empty dictionary in context param https://druid.apache.org/docs/latest/querying/query-context.html