This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Clone

    Learn how to clone databases and environments in Piglet Run.

    Overview

    Cloning allows you to create exact copies of:

    • Database: Clone a database for testing or development
    • Environment: Clone the entire Piglet Run instance
    • Schema Only: Clone structure without data

    Quick Clone

    Clone a database instantly:

    pig clone db mydb mydb_copy
    

    Clone Database

    Full Clone

    pig clone db production development
    

    Schema Only

    pig clone db production development --schema-only
    

    Clone with Data Filter

    pig clone db production development --filter "created_at > '2024-01-01'"
    

    Clone Environment

    Create Environment Clone

    pig clone env --name staging
    

    Clone to Remote Server

    pig clone env --target user@remote-server
    

    Clone from Snapshot

    pig clone snapshot snap-20240115 --name dev-clone
    

    Clone Options

    OptionDescription
    --schema-onlyClone structure without data
    --no-ownerSkip ownership information
    --no-privilegesSkip privilege information
    --parallel NUse N parallel jobs

    Use Cases

    • Development: Clone production for local development
    • Testing: Create isolated test environments
    • Analytics: Clone for reporting without impacting production

    Next Steps