Use the Copy Schema From dialog to insert an existing schema into the Fields grid of an Edit Schema tab in the Properties view, or in an Edit Named Schema or Edit Table Schema dialog. Copy Schema From is also available in the Properties view for arcs when you select the Declare option.
Copying schemas allows you to use an existing schema to avoid manually entering the fields. However, the copied fields are only copies, and are inserted as a private schema into the currently selected field grid. If the original schema changes, the copy does not change. For most purposes, TIBCO recommends using named schemas if your goal is to implement reusable schemas.
To display the Copy Schema From dialog, with an input stream or arc selected, choose the Schema tab or Edit Schema tab and click the Copy Schema from Existing Component button. You can also click this button from the Edit Named Schema or Edit Table Schema features in the Definitions tab. The following image shows a Copy Schema From dialog.
-
You can copy schemas from the following places:
- From system container schemas
-
Copy from the schema of a stream in the global system container. For example, you can copy the schema of the standard StreamBase error tuple by selecting error:schema from the first drop-down list after selecting the From system container schemas radio button.
- From File (CSV, XML, XSD, ZIP ...)
-
Opens the specified file and attempts to convert its contents into StreamBase schema format. Supported file types are:
-
CSV — Comma-separated values files, with or without a header row.
-
XML — Structured data in XML files.
-
XSD — Standard XML Schema files that define a schema.
-
ZIP — Compressed files in zip format that contain one of the above file types.
After selecting a file from a workspace or file system, a preview of the file is shown, if possible.
For CSV files, specify delimiter and quote characters before copying the CSV format into a schema. When you click
, Studio attempts to infer data types from the first few column values (you can later change the types it chooses). Auto-detection of int, double, boolean, string, timestamp and tuples are supported, but not lists or functions. When indicating tuples, the CSV header must identify sub-tuples with dot notation, such asstock.symbol
andstock.price.
For XML files, Studio attempts to infer data types from attribute values for elements.
For XSD files, Studio uses the XSD data type definitions to generate the schema. XSD files are used by many TIBCO products to save schema structure information. Use this feature to migrate schemas in XSD format from other TIBCO products into
-
- From schemas in any workspace module or interface
-
Copy from the schema of any component in any EventFlow or StreamSQL module or interface in any project in the current Studio workspace. You can copy the schemas from named schemas defined in the current module, or from any intermediate stream in any module.
-
Select From schemas in any workspace application or interface.
-
Select the project of interest from the Project drop-down control. Projects are the same as the top-level folders in the Package Explorer view.
-
Select a module or interface from the Application control, which lists the EventFlow or StreamSQL modules and interfaces in the selected project.
-
Select a schema from one of the components listed in the Copy schema from section. Click the left-side arrowhead to expand component sections to see the available schemas of each type.
-
-
Confirm the contents of the selected schema in the Schema Preview section.
-
Click
to close the dialog. -
If your current component's schema grid already contains schema fields, a dialog is displayed prompting you to confirm that you want to replace those fields. Click
to overwrite the current fields in the current schema grid.
The fields of the schema you selected are inserted in the Fields grid of the current component. If you invoked the Copy Schema From dialog from an Edit Named Schema dialog, the converted schema is copied to the named schema's definition grid.