public class SodaImporter extends SodaDdl
| Modifier and Type | Field and Description |
|---|---|
static String |
SCAN_BASE_PATH |
ASSET_BASE_PATH, COLUMNS_PATH, SEARCH_BASE_PATHAPI_BASE_PATH, GEO_BASE_PATH, geocodingUri, httpLowLevel, mapper, TICKET_CHECK, VIEWS_BASE_PATH, viewUri| Constructor and Description |
|---|
SodaImporter(HttpLowLevel httpLowLevel)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
DatasetInfo |
append(String datasetId,
File file,
int skip,
String[] translation)
This appends the contents of a file to a dataset on Socrata.
|
DatasetInfo |
createViewFromCsv(String name,
String description,
File file)
Creates a dataset from a CSV, using all the default column types.
|
DatasetInfo |
createViewFromCsv(String name,
String description,
File file,
String rowIdentifierColumnName)
Creates a dataset from a CSV, using all the default column types.
|
String[] |
generateTranslation(Blueprint blueprint)
Creates a straight translation with no transforms for a given bluprint.
|
NonDataFileDataset |
importNonDataFile(String name,
String description,
File file)
Imports a file that is NOT going to be used to create a datset, but is instead available for
downloading directly.
|
DatasetInfo |
importScanResults(Blueprint blueprint,
String[] translation,
File file,
ScanResults scanResults)
Imports the results of scanning a file.
|
DatasetInfo |
importScanResults(String name,
String description,
File file,
ScanResults scanResults)
Imports the results of scanning a file.
|
DatasetInfo |
importScanResults(String name,
String description,
File file,
ScanResults scanResults,
String rowIdentifierColumnName)
Imports the results of scanning a file.
|
static SodaImporter |
newImporter(String url,
String userName,
String password,
String token)
Create a new SodaImporter object, using the supplied credentials for authentication.
|
DatasetInfo |
replace(String datasetId,
File file,
int skip,
String[] translation)
This replaces the contents of a file to a dataset on Socrata.
|
ScanResults |
scan(File file)
Scans a file, then sends it up to the Socrata service to be analyzed and have things
like column types guessed.
|
protected DatasetInfo |
sendScanResults(String basePostBody,
String fileId,
String[] translation,
File file) |
protected DatasetInfo |
updateFromScanResults(String datasetId,
String method,
int skip,
String fileId,
String[] translation,
File file) |
addAsset, addColumn, alterColumn, createDataset, deleteDataset, getAsset, loadDatasetInfo, newDdl, removeColumn, searchViews, updateDatasetInfocreateWorkingCopy, findPendingGeocodingResults, getHttpLowLevel, makePrivate, makePublic, newWorkflow, publish, waitForPendingGeocodingpublic static final String SCAN_BASE_PATH
public SodaImporter(HttpLowLevel httpLowLevel)
httpLowLevel - the HttpLowLevel this uses to contact the serverpublic static final SodaImporter newImporter(String url, String userName, String password, String token)
url - the base URL for the SODA2 domain to access.userName - user name to log in aspassword - password to log in withtoken - the App Token to use for authorization and usage tracking. If this is null, no value will be sent.public DatasetInfo createViewFromCsv(String name, String description, File file, @Nullable String rowIdentifierColumnName) throws InterruptedException, SodaError, IOException
name - name of the dataset to createdescription - description of the new datasetfile - the file to uploadrowIdentifierColumnName - row identifieInterruptedExceptionSodaErrorIOExceptionpublic DatasetInfo createViewFromCsv(String name, String description, File file) throws InterruptedException, SodaError, IOException
name - name of the dataset to createdescription - description of the new datasetfile - the file to uploadInterruptedExceptionSodaErrorIOExceptionpublic ScanResults scan(File file) throws SodaError, InterruptedException
file - File to uploadSodaErrorInterruptedExceptionpublic DatasetInfo importScanResults(String name, String description, File file, ScanResults scanResults) throws SodaError, InterruptedException, IOException
name - name of the dataset to createdescription - description of the datsetfile - file that was scannedscanResults - results of the scanSodaErrorInterruptedExceptionIOExceptionpublic DatasetInfo importScanResults(String name, String description, File file, ScanResults scanResults, @Nullable String rowIdentifierColumnName) throws SodaError, InterruptedException, IOException
name - name of the dataset to createdescription - description of the datsetfile - file that was scannedscanResults - results of the scanSodaErrorInterruptedExceptionIOExceptionpublic DatasetInfo importScanResults(Blueprint blueprint, String[] translation, File file, ScanResults scanResults) throws SodaError, InterruptedException, IOException
blueprint - translation - file - file that was scannedscanResults - results of the scanSodaErrorInterruptedExceptionIOExceptionpublic DatasetInfo append(String datasetId, File file, int skip, String[] translation) throws SodaError, InterruptedException, IOException
datasetId - id of the dataset to append tofile - file with the data in itskip - number of rows in the data to skip (normally for skipping headers)translation - an optional translation array for translating from values in the file and values in the dataset.SodaErrorInterruptedExceptionIOExceptionpublic DatasetInfo replace(String datasetId, File file, int skip, String[] translation) throws SodaError, InterruptedException, IOException
datasetId - id of the dataset to append tofile - file with the data in itskip - number of rows in the data to skip (normally for skipping headers)translation - an optional translation array for translating from values in the file and values in the dataset.SodaErrorInterruptedExceptionIOExceptionprotected DatasetInfo updateFromScanResults(String datasetId, String method, int skip, String fileId, String[] translation, File file) throws SodaError, InterruptedException, IOException
SodaErrorInterruptedExceptionIOExceptionprotected DatasetInfo sendScanResults(String basePostBody, String fileId, String[] translation, File file) throws SodaError, InterruptedException, IOException
SodaErrorInterruptedExceptionIOExceptionpublic NonDataFileDataset importNonDataFile(String name, String description, File file) throws SodaError, InterruptedException
name - name of the filedescription - description of the filefile - the file to uploadSodaErrorInterruptedExceptionpublic String[] generateTranslation(Blueprint blueprint)
blueprint - blueprint to build the translation fromCopyright © 2013. All Rights Reserved.