Jump to content

Exporting data list


Vegini

Recommended Posts

Hello everyone, 

I was wondering whether there was a way for me to export or download a list of all the indexed data that is connected to the workbench. I don't need to values in these files, rather just a list of the names of all the indexed files in there. 

Thank you,

Vegini

index.jpg

Link to comment
Share on other sites

Hi Vegini,

I guess there are two ways to accomplish this. 

First one is using Seeq CLI using the command seeq datasource items on the Seeq server. As you can see below you are able to filter for specific datasources you are interested in and also export the results to a .csv file.

image.png.300a0c7604a47c630ead978747429771.png

To get the name, class or id of a datasource you can execute seeq datasource list first to get the desired information to be used for filtering:image.thumb.png.60b5a5780b05fcad5ffed259b342087e.png

 

More information on the CLI can be found here: https://support.seeq.com/space/KB/215384254/Seeq%20Server%20Command%20Line%20Interface%20(CLI)

The second way would be utilizing the API, for example in a python script. As you see you have to specify the ID of the datasource to get the associated items. 

image.thumb.png.e5fb7d1f66da148f0c58ed080db158dd.png

The ID of a datasource can be determined by calling the datasources endpoint:

image.thumb.png.a37f31d72ade275fad6f56dac58c7f3c.png

 

Hope this helps.

Regards,

Thorsten

  • Like 3
Link to comment
Share on other sites

The API shown above returns the data in JSON format. To create a CSV file you

- can write some custom code making use of the Seeq SDKs (here Python)

import seeq_sdk as sdk
import csv
 
# login prompt definition
def get_authenticated_client(api_url):
    api_client = sdk.ApiClient(api_url)
    auth_api = sdk.AuthApi(api_client)
    auth_input = sdk.AuthInputV1()
    auth_input.username =  <username>
    auth_input.password = <password>
    auth_input.auth_provider_class = "Auth"
    auth_input.auth_provider_id = "Seeq"
    auth_api.login(body=auth_input)
    return api_client

seeq_api_url = 'http://seeqserver:34216/api'
seeq_api_client = get_authenticated_client(seeq_api_url)
datasourcesApi = sdk.DatasourcesApi(seeq_api_client)
output = datasourcesApi.get_items_hosted_by_datasource(id=<id of datasource>, limit=300)

with open("C:\\temp\\items.csv", "w", newline='') as csvFile:
    writer = csv.writer(csvFile)
    writer.writerow(["Name", "Type"])
    for item in output.items:
        writer.writerow([item.name, item.type])

- take the output from the response body and use 3rd-party tools to convert to csv

- use Seeq Data Lab (requires Seeq Data Lab license)

data = spy.search({"Datasource Name": "Example Data"})
data.to_csv('items.csv')

Regards,

Thorsten

Edited by Thorsten Vogt
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...