cmd

package
v0.0.0-...-7c47925 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadCmd = &cobra.Command{
	Deprecated: "use `table load` instead",
	Use:        "load",
	Short:      "Loads data into a table.",
	Run: func(cmd *cobra.Command, args []string) {
		log.Debug().Msg("starting load")

		var fileType apiv1alpha.FileType
		switch fileTypeIn {
		case "parquet", "":
			fileType = apiv1alpha.FileType_FILE_TYPE_PARQUET
		case "csv":
			fileType = apiv1alpha.FileType_FILE_TYPE_CSV
		default:
			utils.LogAndQuitIfErrorExists(fmt.Errorf("unrecognized file type - must be one of 'parquet', 'csv'"))
		}

		if len(filePaths) == 0 {
			utils.LogAndQuitIfErrorExists(fmt.Errorf("at least one `file` flag must be set"))
		}

		apiClient := api.NewApiClient()
		for _, file := range filePaths {
			err := apiClient.LoadFile(tableName, &apiv1alpha.FileInput{FileType: fileType, Uri: file})
			utils.LogAndQuitIfErrorExists(err)
		}
		log.Debug().Msg("Success!")
	},
}

LoadCmd represents the load command

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL