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

GetNestedFieldValueFromInterface returning nil, if a column name contains dot(.) #21

Closed
Subhajit97 opened this issue Jun 10, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Subhajit97
Copy link

I'm trying to query a CSV file defined as below:

"subscriptions.id","subscriptions_plan_id","subscriptions_plan_quantity"
a,b,1
d,e,2

where subscriptions.id is a header and the name contains a dot(.).

In the plugin, we are using transform.FromField(...) transform to get the value, e.g. transform.FromField("subscrptions.id")
While trying to query the table, the query returns null for column subscriptions.id.

Actual Output

+------------------+-----------------------+-----------------------------+---------------------------+
| subscriptions.id | subscriptions_plan_id | subscriptions_plan_quantity | _ctx                      |
+------------------+-----------------------+-----------------------------+---------------------------+
| <null>           | e                     | 2                           | {"connection_name":"csv"} |
| <null>           | b                     | 1                           | {"connection_name":"csv"} |
+------------------+-----------------------+-----------------------------+---------------------------+ 

Expected Output

+------------------+-----------------------+-----------------------------+---------------------------+
| subscriptions.id | subscriptions_plan_id | subscriptions_plan_quantity | _ctx                      |
+------------------+-----------------------+-----------------------------+---------------------------+
| a                | e                     | 2                           | {"connection_name":"csv"} |
| d                | b                     | 1                           | {"connection_name":"csv"} |
+------------------+-----------------------+-----------------------------+---------------------------+ 

Steps to reproduce:

  • Install the CSV plugin
  • Create a .csv file defined as below
    "subscriptions.id","subscriptions_plan_id","subscriptions_plan_quantity"
    a,b,1
    d,e,2
    
  • Run steampipe query and query this table select * from <file_name>
@Subhajit97 Subhajit97 added the bug Something isn't working label Jun 10, 2022
@Subhajit97
Copy link
Author

I was trying to validate the FromField functionality https://go.dev/play/p/E0nFpoUWjW0.

From SDK GetNestedFieldValueFromInterface function checks for the value of the given property path (e.g subscriptions.id), and since the property path contains dot(.), it seems like it treats this path as a nested path.

var pathSegments = strings.Split(propertyPath, ".")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants