with pydomo using DataSetClient data_export() to export dataset to string
dataset = DataSetClient() include_csv_header = True datasets_parent = dataset.data_export(dataset_id, include_csv_header) # datasets_parent = self.pydomo.datasets.data_export(dataset_id, include_csv_header) logging.info(f'datasets_parent: {datasets_parent}') return datasets_parent but I keep seeing missing 2 required positional arguments: 'transport' and 'logger'
but I don't see any info on what transport and logger is
Comments
-
Logger is a python builtin logging.logger object. You can read the documentation on that object here: https://docs.python.org/3/library/logging.html
transport is an instance of DomoAPITransport object: https://github.com/domoinc/domo-python-sdk/blob/dacdee87d9e798f4c83f270b38c8ea2b1b6c7923/pydomo/Transport.py#L8
You need to pass in your transport and logger objects as the first and second parameter respectively when instantiating the DataSetClient object. https://github.com/domoinc/domo-python-sdk/blob/94c33af084427fcb03e1ebd6932e794ce9611188/pydomo/datasets/DataSetClient.py#L24
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
Hi @GrantSmith , thanks for responding. The Transport bit is confusing me. Do I also have to call the DomoAPITransport class in order to call the DataSetClient?
dataset = DataSetClient(transport=DomoAPITransport(client_id, client_secret, api_host, use_https, logger, request_timeout), logger =logger) include_csv_header = True datasets_parent = dataset.data_export(dataset_id, include_csv_header)
0 -
@GrantSmith - Also, regarding the logger part, can you clarify more on what exactly to add for this parameter?
0 -
It's easiest to just instantiate a Domo object with your client ID and secret which will handle the transport object creation.
Something like this:
import logging # Logger object # My Domo Client ID and Secret (https://developer.domo.com/manage-clients) # Update these CLIENT_ID = 'MY_CLIENT_ID' CLIENT_SECRET = 'MY_CLIENT_SECRET' # The Domo API host domain. This can be changed as needed - for use with a proxy or test environment API_HOST = 'api.domo.com' handler = logging.StreamHandler() handler.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) logging.getLogger().addHandler(handler) domo = Domo(client_id, client_secret, logger_name='foo', log_level=logging.INFO, api_host=API_HOST, **kwargs) # Your code with one modification - you can access the DataSetClient from your Domo object: dataset = domo.dataset include_csv_header = True datasets_parent = dataset.data_export(dataset_id, include_csv_header) # datasets_parent = self.pydomo.datasets.data_export(dataset_id, include_csv_header) logging.info(f'datasets_parent: {datasets_parent}')
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
0
-
Hi @GrantSmith - ignore that last message, I just needed to change it to "datasets" .
But the dataset I'm trying to download is 257 million rows, and it seems to be timing out each time I try the code you had sent, is there a way to split it out into chunks perhaps within the code so this doesn't happen?
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive