Skip to content

[Good First Issue] Add __str__ and __repr__ to DataSet Class for Better Debugging #93

Description

@raphael-intugle

The Problem

Currently, the DataSet class in src/intugle/analysis/models.py lacks a user-friendly string representation. When a developer prints a DataSet object, the output is a generic Python object representation (e.g., <intugle.analysis.models.DataSet object at 0x... >), which is not informative for debugging or interactive use.

Proposed Solution

We should implement the __str__ and __repr__ methods on the DataSet class to provide a more descriptive and helpful output.

The representation should include key information about the dataset, such as its name, path, type etc. It might change depending on the connector

Example of desired output:
If its a local filepath:

# After the change, printing the object should look like this:
data_source = {"path": "path/to/my_data.csv", "type": "csv"}
dataset = DataSet(data_source, name="customer_data")
print(dataset)

# Expected output:
# DataSet(name='customer_data' path='path/to/my_data.csv' type='csv')

If its a Snowflake Connector:

# After the change, printing the object should look like this:
data_source = {"identifier": "SNOWFLAKE_DB.SCHEMA.CUSTOMERS", "type": "snowflake"}
dataset = DataSet(data_source, name="customer_data")
print(dataset)

# Expected output:
# DataSet(name='customer_data' identifier='SNOWFLAKE_DB.SCHEMA.CUSTOMERS' type='snowflake')

Files to Modify

  • src/intugle/analysis/models.py

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions