frictionlessdata / forum

🗣 Frictionless Data Forum esp for "How do I" type questions
https://frictionlessdata.io/
10 stars 0 forks source link

Unable to read only specified columns from the postgresql database #54

Closed Swarnitha-eluru closed 4 years ago

Swarnitha-eluru commented 4 years ago

I need to specify particular columns and read them(as like select statement) from the postgresql database . I tried using pick_columns and skip_columns but it didnot worked it displayed only few columns out of specified ones. this is the code written image This is the output I got it is not able to show all when I read its only showing in selected headers. image

So please suggest on this

rufuspollock commented 4 years ago

@Swarnitha-eluru can you give more details of what the db looks like and what your desired output is.

Swarnitha-eluru commented 4 years ago

image

this is the data in my postgrsql i should read only id,name,phnno columns from the table and write to .csv file or whatever it is.

rufuspollock commented 4 years ago

So your bug is that it is writing all the columns?

Swarnitha-eluru commented 4 years ago

yes i need to write only selected columns i.e among id,name,address,age,phnno of my table i want to read and write only id,name,phnno

rufuspollock commented 4 years ago

@roll any thoughts?

roll commented 4 years ago

Hi @Swarnitha-eluru,

The data discovery API (skip/pick/etc) is quite new and experimental. I was able to find a similar problem in it for keyed resources (like SQL) and now it's fixed with tabulator@1.52.3.

Please let me know if your problem still exists

Swarnitha-eluru commented 4 years ago

ok thanks for the update

Swarnitha-eluru commented 4 years ago

@roll I installed the version suggested by you. I wrote code to skip some columns from the postgresql table. image image

The issue I found was when I need 4 columns out of 5 as per my example, its is showing the list of selected columns when I used stream.headers,but when i read them I am seeing only data of 3 columns for all the rows. This is what i find in my testing.

roll commented 4 years ago

@Swarnitha-eluru thanks for reporting! I'll investigate tomorrow

Swarnitha-eluru commented 4 years ago

@roll thankyou

roll commented 4 years ago

Hi @Swarnitha-eluru,

Sorry for the delay with the answer but I wasn't able to reproduce your problem. Could please share the table dump and the code you run as a text?

Also could you please ensure that

print(tabulator.__version__)
# 1.52.3
Swarnitha-eluru commented 4 years ago

hi @roll Its okay.I tested the version by including your print statement I got the version as 1.38.2 .I was really shocked as I installed 1.52.3 few days back when you suggested .So I uninstalled the tabulator its showed me that i uninstalled 1.52.3.

After uninstalling I again installed 1.52.3 .Then I ran my code snippet It worked me well. Thanks for solving and helping in this issue.