Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a function to search all tables by name #24

Closed
CurtLH opened this issue Dec 7, 2020 · 1 comment
Closed

Create a function to search all tables by name #24

CurtLH opened this issue Dec 7, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@CurtLH
Copy link
Contributor

CurtLH commented Dec 7, 2020

Current Issue

One way of finding the table_wid of an existing table is as follows:

all_tables = p.list_table()
for table in all_tables['data']:
    if table['name'] == "my_new_table":
        print(table)
        break

This snippet of code is not only wordy but also error prone if you have more than 100 tables, as that is the maximum returned from list_tables().

Proposed Solution

I propose we create a new function that is something like find_table("table_name") that will search all of your existing tables, on all available pages of results, and if the search string is found, that table will be returned. If multiple tables contain the same search string, maybe we return them all in a list? The function should also indicate what has or has not been found through logging messages to the user.

Example Usage

# find the table
> table = p.find_table("table_name_BDS")
2020-12-07 01:07:39 INFO: Found 1 table(s) containing "table_name_BDS"
# inspect table data
> type(table)
dict
# find the table
> table = p.find_table("BDS")
2020-12-07 01:07:39 INFO: Found 10 table(s) containing "BDS"
# inspect table data
> type(table)
list
@CurtLH CurtLH added the enhancement New feature or request label Dec 7, 2020
@CurtLH
Copy link
Contributor Author

CurtLH commented Nov 21, 2023

Closed by #50

@CurtLH CurtLH closed this as completed Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant