vast-data / vastpy

VASTPY is the official Python SDK for the VAST Management System
Apache License 2.0
6 stars 1 forks source link

Strange result with tables get #2

Open snowch opened 2 months ago

snowch commented 2 months ago

I'm trying to get a list of tables:

  for table in client.tables.get(database_name='vast-db', schema_name='vast-db', page=1, page_size=1000):
        print('table::::', table, type(table))

However, this returns:

table:::: count <class 'str'>
table:::: next <class 'str'>
table:::: previous <class 'str'>
table:::: results <class 'str'>

If I inspect the API calls from my browser when accessing the VMS, I see:

{"count":1,"next":null,"previous":null,"results":[{"database_name":"vast-db","schema_name":"vast-db","name":"aaa","properties":null,"num_rows":0,"size":0}]}

Am I using the vastpy library right?

snowch commented 2 months ago

The workaround:

This worked for me:

        tables = client.tables.get(database_name='vast-db', schema_name='vast-db')['results']
        for table in tables:
            print(f"Table {table['name']} in schema {table['schema_name']} in database {table['database_name']}")