--- title: "CreatePackage" slug: "createpackage" updated: 2024-11-05T17:30:51Z published: 2024-11-05T17:30:51Z canonical: "docs.datajet.app/createpackage" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # CreatePackage Creates a zip package that can be used to [inject shared data definitions](/v1/docs/deep-dive-sharing-data-by-injection) into consumer projects. | Key | Value(s) | Description | | --- | --- | --- | | method | "CreatePackage" | Creates a zip package that can be used to inject shared data definitions into consumer projects. | | path | "Path or filename" | Required, unless "name" is used. [**Path & Filename**] to the package file. Only one of "name" or "path" can be used. | | name | | Optional. Default = "" If used, "push" must be true. Cannot be used if "path" is specified. Only one of "name" or "path" can be used. | | push | true/false | Optional. Default = false. Required if using "name" rather than "path" If [Storage Hub](/v1/docs/storage-hub) has been configured, will add the package to the storage hub. If storage hub has not been configured, use "path" instead. | | includeProjectMetaData | true/false | Optional. Default = true. If true, [metadata definitions](/v1/docs/getting-started-categories-and-metadata) (i.e., categories, codes, descriptions etc) will be included in the package. | | targetProject | "ProjectName" | Required. The name of the **source** project containing the objects from which to create the data package. | | tables[] | [ "table1", "table2", "table3", "*" ] | Optional. Default = "" The tables to include in the package. To include all tables, use "*" | | reports[] | [ "report1", "report2", "report3", "*" ] | Optional. Default = "" The reports to include in the package. To include all reports, use "*" | | stdReports[] | [ "stdReport1", "stdReport2", "stdReport3", "*" ] | Optional. Default = "" The standardized reports to include in the package. To include all standardized reports, use "*" | | autoLock | true/false | Added in v5.8.15 Optional. Default = true. If true, flags targetProject as protected. (Note: is it not possible to drop protected projects. Use **Projects \| Manage Projects** to change project protection) | | project | "CurrentProjectName" | | | includeCampaignConfiguration | true/false | Added in v6.11.11.01 Optional. Default = false If true, includes campaign information in package file. When package is injected, consumer project will be campaign enabled. The last package that is injected into the consumer project is the campaign configuration that will be used. | Package files can be identified by **filename**, or by **package name.** #### **Filename** - **filename** - a full path and filename for the package zip file must be provided. - When CREATING: - use "*path*" key to specify the path, or [path and filename] when ***creating*** the package, e.g., "%DATAPATH%NewPackageFileName.zip" - When INJECTING: - use "*path*" key to specify the filename when ***injecting*** the package (see [InjectPackage](/v1/docs/injectpackage)) - use "*homePath*" key to point to the underlying data files, e.g., "%REPOS%/SourceProject_A" - Existing files of the same name will be overwritten. - Assuming the file is output to %DATAPATH%, the resulting package file can be found in **Admin | Remote Files** ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1730826400539.png) #### **Package Name** - **package name**- usually packages are stored in the [storage hub](/v1/docs/storage-hub) and accessed via the [package helper](/v1/docs/package-manager)wizard. - To store a package in the hub, use the "*name*" key and set "*push*" to true. - To use a package created using the name method, use the "*name*" key in InjectPackage![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1730811255365.png) WarningCreatePackage will over-write existing files in the Storage Hub if "name" matches an existing package name. #### **Notes** - Dependencies are always written into the package file. - Joins are automatically included between any tables that are in the package. #### Package Contents The following objects are included in a package file: - tables and fields - field templates - reports (free-flow and standardized) - metadata Note that datasets and collections are not included in packages. #### Project | Create Package If the Storage Hub has been configured, Packages for the current project can be created using **Project | Create Package**. This will create a package of specified name and automatically push it to the hub. To see the CreatePackage method generated when creating the package, use one of the following methods: 1. **Script Editor | File | Import Definitions**.   Select the *CreatePackage* method and add to the active script. 2. Press **Script Editor | Record** before selecting **Project | Create Package**.  The *CreatePackage* method will be added to the active script. For a more detailed look at working with injected data, see **Introduction to Data Injection** #### Example using explicit "path" to package file (filename) Use CreatePackage to create package file: ```json { "method": "CreatePackage", "path": "%DATAPATH%/06_Packages/dj-localhost_CONSUMER_Test1_20241105_145735_1.zip", "push": false, "system": false, "targetProject": "CONSUMER_Test1", "includeProjectMetadata": true, "autoLock": false, "tables": [ "*" ], "reports": [ "*" ], "template": [ "*" ], "createMetafile": true, "project": "CONSUMER_Test1" } ``` Use InjectPackage to import package file by filename: ```json { "method": "InjectPackage", "path": "%DATAPATH%/06_Packages/dj-localhost_CONSUMER_Test1_20241105_145735_1.zip", "homePath": "%REPOS%CONSUMER_Test1", "targetProject": "Injection_Test_Basic", "includeProjectMetaData": true, "sourceName": "Test Consumer Project", "sortMode": 0, "errorOnMissingDataFiles": false, "pull": false, "project": "CONSUMER_Test1" } ``` #### Named package files Use CreatePackage with the "name" property to create a package from **CONSUMER_Test1**: ```json { "method": "CreatePackage", "name": "Consumer_Package1", "push": true, "system": false, "targetProject": "CONSUMER_Test1", "includeProjectMetadata": true, "autoLock": false, "createMetafile": true, "project": "CONSUMER_Test1" } ``` Then use InjectPackage to inject the data into project **Injection_Test_Basic**: ```json { "method": "InjectPackage", "name": "Consumer_Package1", "targetProject": "Injection_Test_Basic", "includeProjectMetaData": true, "sourceName": "Test Consumer Project", "sortMode": 0, "errorOnMissingDataFiles": false, "pull": true, "project": "CONSUMER_Test1" } ``` #### Example created using Project | Create Package ```json { "method": "CreatePackage", "includeProjectMetadata": true, "createMetafile": true, "autoLock": false, "push": true, "name": "BProject22024-10-31-13-57-26", "targetProject": "BProject2", "project": "BProject2" } ```