backup

package module
v0.0.0-...-c09c644 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 11 Imported by: 0

README

go-exasol-backup

A Go utility for backing up Exasol metadata and, optionally, data to text files. Metadata includes DDL, users, roles, connections, permissions and system parameters. The metadata is stored as SQL and data is stored as CSV.

Synopsis

import (
    "github.com/grantstreetgroup/go-exasol-backup"
    "github.com/grantstreetgroup/go-exasol-client"
)

func main() {
    err := backup.Backup(backup.Conf{
        Source:      exasol.Connect(exasol.ConnConf{ ... })
        Destination: "/directory/to/backup/to/",
        Objects:     []backup.Object{backup.ALL},
    })
    if err != nil {
        log.Fatal(err)
    }
}

Configs

  • Source: Pointer to an Exasol connection to backup from.
  • Destination: Path to a filesystem directory to store the backup SQL/CSV
  • Objects: List of object types to backup. It can be one or more of the following constants: CONNECTIONS, FUNCTIONS, PARAMETERS, PRIORITY_GROUPS, ROLES, SCHEMAS, SCRIPTS, TABLES, USERS, VIEWS, or ALL
  • Match: You can restrict which objects are backed up using the Match and Skip configs. Match is a comma delimited set of wildcard matching patterns. Any schema object matching one of these patterns will be backedup. Each pattern should be in the form of schema.object. If the object is not specified schema.* is assumed. If the schema is not specified then *.* is assumed. Non-schema objects (users, roles, connections, parameters) are not affected by this config. i.e. they will be backed up all-or-none.
  • Skip: Skip is the inverse of Match. Any schema objects matching it will be skipped. Same rules apply.
  • MaxTableRows: If > 0 then tables with this many or fewer rows will have the their data backed up to CSV files. If 0 then no table data will be backed up (Default).
  • MaxViewRows: If > 0 then views with this many or fewer rows will have the their data backed up to CSV files. If 0 then no view data will be backed up (Default).
  • DropExtras: If true then any text files existing in the destination but no longer existing in Exasol will be removed. If false then the backup is purely additive (Default).
  • LogLevel: Defaults to warning

Author

Grant Street Group developers@grantstreet.com

This software is Copyright (c) 2020 by Grant Street Group.

This is free software, licensed under:

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup

func Backup(cfg Conf) error

func BackupConnections

func BackupConnections(src *exasol.Conn, dst string) error

func BackupConsumerGroups

func BackupConsumerGroups(src *exasol.Conn, dst string) error

func BackupFunctions

func BackupFunctions(src *exasol.Conn, dst string, crit Criteria, dropExtras bool) error

func BackupParameters

func BackupParameters(src *exasol.Conn, dst string) error

func BackupPriorityGroups

func BackupPriorityGroups(src *exasol.Conn, dst string) error

func BackupPrivileges

func BackupPrivileges(src *exasol.Conn, dst string, grantees []string) error

func BackupRoles

func BackupRoles(src *exasol.Conn, dst string, dropExtras bool) error

func BackupSchemas

func BackupSchemas(src *exasol.Conn, dst string, crit Criteria, dropExtras bool) error

func BackupScripts

func BackupScripts(src *exasol.Conn, dst string, crit Criteria, dropExtras bool) error

func BackupTables

func BackupTables(src *exasol.Conn, dst string, crit Criteria, maxRows int, dropExtras bool) error

func BackupUsers

func BackupUsers(src *exasol.Conn, dst string, dropExtras bool) error

func BackupViews

func BackupViews(src *exasol.Conn, dst string, crit Criteria, maxRows int, dropExtras bool) error

Types

type Conf

type Conf struct {
	// Exasol instance to backup from
	Source *exasol.Conn
	// Local filesystem directory underwhich to store the backup
	Destination string
	// The list of object types to backup
	Objects []Object

	// Match is a comma delimited set of wildcard matching patterns.
	// Any schema object matching one of these patterns will be backedup.
	// Each pattern should be in the form of "schema.object".
	// If the object is not specified "schema.*" is assumed.
	// If the schema not specified then "*.*" is assumed.
	// Non-schema objects (users, roles, connections, parameters) are
	// not affected by this config. i.e. they will be backup all-or-none
	Match string
	// Skip is the inverse of Match.
	// Any schema objects matching it will be skipped.
	Skip string

	// If > 0 then tables with this many or fewer rows
	// will have the their data backed up to CSV files.
	// If 0 then no table data will be backed up.
	MaxTableRows int
	// If > 0 then views with this many or fewer rows
	// will have the their data backed up to CSV files.
	// If 0 then no view data will be backed up.
	MaxViewRows int

	// If true then any text files existing in the destination
	// but no longer existing in Exasol will be removed.
	// If false then the backup is purely additive
	DropExtras bool

	LogLevel string // Defaults to "warning"
}

type Criteria

type Criteria struct {
	// contains filtered or unexported fields
}

type Object

type Object byte
const (
	ALL Object = iota
	CONNECTIONS
	FUNCTIONS
	PARAMETERS
	PRIORITY_GROUPS // Pre-Exasol 7.0
	CONSUMER_GROUPS // Exasol 7.0+
	ROLES
	SCHEMAS // This would backup the (virtual)schema itself but nothing under it
	SCRIPTS
	TABLES
	USERS
	VIEWS
)

Jump to

Keyboard shortcuts

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