# Pyq Server Connexion

**URL:** <https://forum.kx.com/t/pyq-server-connexion/11928>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [July 23, 2019, 9:45am UTC](https://forum.kx.com/t/pyq-server-connexion/11928 "2019-07-23T09:45:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anas](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@Anas](https://forum.kx.com/u/Anas)\
**Post date:** [July 23, 2019, 9:45am UTC](https://forum.kx.com/t/pyq-server-connexion/11928/1 "2019-07-23T09:45:00Z")

</div>

Hello,

I am trying to use the fantastic PyQ package but I have trouble to connect to my Kdb database: I am trying without success this&nbsp;

import pyq as q&nbsp;

%%q hopen `:hostname:port:login:

tables

I do not need a password. It looks like what Qpad does right ? but for some reason I do not access to it. Someone has an idea of what I am doing wrong ?

Thx&nbsp;

Best,

---

<div class="post-metadata">

**Author:** ![David\_Martin](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@David\_Martin](https://forum.kx.com/u/David_Martin)\
**Post date:** [July 23, 2019, 1:57pm UTC](https://forum.kx.com/t/pyq-server-connexion/11928/2 "2019-07-23T13:57:00Z")

</div>

Hi A Im,  
There is a few things you need to change in your code to get it to work.You should be using the PyQ kernel, then you won’t need to import q.You are also better to set your hopen to a variable as you will need to use it to get access to your port.Here is the code I got working

```
%%q
h:hopen `:hostname:port:login
h"tables[]"

```

Regards,  
David

---

<div class="post-metadata">

**Author:** ![michel\_berne201](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@michel\_berne201](https://forum.kx.com/u/michel_berne201)\
**Post date:** [July 23, 2019, 4:44pm UTC](https://forum.kx.com/t/pyq-server-connexion/11928/3 "2019-07-23T16:44:00Z")

</div>

Hello,

Thank you for your answer. I forgot the h “”. It is a bit annoying to have to put those “” for each line.

I liked the q.Price approach from&nbsp;https://pyq.enlnt.com/slides/#/14. (Really convinient)

\<o:p\>\</o:p\>

In our case it would be q.h(“Price”)

But I guess that is the way to do to access the data.

Thank you !
