SQLCreator
Generates FME features from the results of a SQL query executed once against a database. One FME feature is created for each row of the results of the SQL query.
典型用途
- 提取数据库记录根据SQL语句作为FME功能
- 从数据库中端翻译添加功能
- Execute a database join
How does it work?
The SQLCreator executes a SQL statement against a database. It has no input ports, and so (unlike theSQLExecutor) is not reliant on incoming features to trigger the statement - rather, the query is run仅一次。
SQL语句变压器内部构造,使用使用的数据库中的相应的语法。如果数据库支持空间谓语空间查询的支持。
一个特征是用于查询结果的每一行输出,经由结果端口。
Examples
在这个例子中,我们将通过查询数据库的PostGIS,它具有含点几何地址表中创建一组要素。我们将使用提取基于邮政编码的数据子集的SELECT语句。
甲SQLCreator被放置在工作区中。
在参数的对话框,该数据库连接被选择(或所定义,如果先前没有保存)。
一个SQL语句的构建SQL语句参数,使用内置的编辑器。语法匹配正在使用的数据库。
There is a convenient shortcut in the editor - by right-clicking on a table (or column) name under Database Tables, you can create a quick statement based on SELECT and more to start editing from.
在这种情况下,我们选择所有的在记录邮寄地址table that have a postal code starting withV6E。
默认情况下,输出具有隐藏属性。选择要包括在属性揭露参数的人。
查询结果中提取,包括几何。注意,只有暴露属性在表视图中可见。
Usage Notes
- 如果数据库支持空间谓词,可使用空间查询。
- 该SQLCreator只能启用SQL数据源一起使用。要使用SQL和非SQL数据,考虑InlineQuerier。
- If all the data to be queried already exists in a SQL-capable data source, it is generally most efficient to use the SQLCreator orSQLExecutor作为查询和数据的滤波它进入FME环境之前直接由数据库中执行。
- 对于简单的一个数据库表连接到的特点,DatabaseJoiner可能是更有效(如果密钥字段(一个或多个)被索引)。该DatabaseJoiner不需要SQL的知识。
选择一个功能接着方式
数据接合基于匹配属性,表达式和/或几何形状许多变压器可以执行。当选择一个特定接合作业,考虑因素包括复杂的加入,数据格式,索引,冲突处理,以及期望的结果。有些变压器使用SQL语法,并直接外部数据库的一些访问。他们可能会或可能不支持列表属性阅读和创作。
Generally, choosing the one that is most specific to the task you need to accomplish will provide the optimal performance results. If there is more than one way to do it (which is frequently the case), time spent on performance testing alternate methods may be worthwhile. Performance may vary greatly depending on the existence of key indexes when reading external tables (as opposed to features already in the workspace).
变压器 |
Match By |
使用SQL语句 |
可以创建列表 |
输入类型 |
显着 |
Description |
---|---|---|---|---|---|---|
FeatureJoiner | 属性 | 没有 | 没有 | Features |
|
Joins features by combining the attributes and/or geometry of features based on common key attribute values. Performs the equivalent of Inner, Left, and Full SQL joins. |
FeatureMerger | 属性 | 没有 | 是 | Features |
|
合并的属性和/或一组特征的几何形状到另一种的功能集,基于匹配键属性值和表达式。 |
ListBasedFeatureMerger | 列表属性为单属性 | 没有 | 是 | Features |
|
Merges the attributes and/or geometry of one set of features onto another set of features, based on matching列表属性values with key attribute values and expressions. |
InlineQuerier | SQL查询 | 是 | 没有 | Features |
|
Creates a set of SQLite database tables from incoming features, executes SQL queries against them, and outputs the results as features. |
SQLCreator | SQL查询 | 是 | 没有 | 外部DB |
|
Generates FME features from the results of a SQL query executed once against a database. One FME feature is created for each row of the results of the SQL query. |
SQLExecutor | SQL查询 | 是 | 没有 | 外部DB |
|
完成SQL查询对数据库。一个查询被颁发给数据库中每个启动功能,进入变压器。两者发起特征和查询的结果可以作为特征输出。 |
DatabaseJoiner | 属性 | 没有 | 是 | 外部DB及特点 |
|
Joins attributes from an external table to features already in a workspace, based on a common key or keys. SQL knowledge not required. Non-blocking transformer. |
匹配 | 几何和/或属性 | 没有 | 是 | Features |
|
检测到彼此的匹配功能。特点声明时,他们几何匹配,匹配的属性值,或两者相匹配。也可以指定必须的特征之间的不同的属性的列表。 如果匹配的属性只(不几何图形),使用FeatureMerger或其它方法将提供更好的性能。 |
组态
输入端口
该SQLCreator没有输入端口。
Output Ports
Features that result from the SQL queries.
On reader errors, outputs a feature with the_reader_error属性包含来自读取器的最后一个错误消息。
被拒绝的功能处理:can be set to either terminate the translation or continue running when it encounters a rejected feature. This setting is available both as a defaultFME选项and as aworkspace parameter。
参数
格式 | Select a database format. |
数据集/连接 | 根据所选择的格式中,选择一个数据集或使用/配置数据库连接。 |
参数 | 特定的格式参数 |
Coord. System | The coordinate system of the database being connected to, as well as the coordinate system of the Result output features. (从源代码读取)保留为默认值或使用来自坐标系统库中进行选择。 |
SQL语句 | Specify the SQL query using the text editor. Multiple SQL commands can be delimited by a character specified using the keywordFME_SQL_DELIMITER,嵌入在SQL语句的开始。单字符紧跟此关键字将被用于分割其然后将被发送到数据库以供执行的SQL。(注:包括字符前留一个空格。) 一个单独的语句可以使用一个连字符前面,表明错误应该被忽略。 注意:有一些数据库格式的支持意见/ * ... * /或双连字符(-). The following example contains two SQL commands where errors from the first command will be ignored: FME_SQL_DELIMITER; - 选择* FROM TABLEA; SELECT * FROM TABLEB; |
属性揭露 | 输入属性的名称,露出由查询创建的功能。这些属性将被作为列表中规定的相同顺序输出。 注意:默认情况下,得到的要素的属性是隐藏的。您可以指定哪些属性输入属性名暴露。单击浏览按钮旁边的属性揭露参数。您也可以使用SQL语句按“从SQL查询填充...”,然后输入一个SQL查询来填充列表。从第一个匹配功能的列将被用于填充属性列表。 |
编辑变压器参数
使用一组菜单选项,变压器参数可以通过引用在工作区中的其它元件来分配。更先进的功能,如高级编辑,算术编辑,也是一些变压器可用。要访问这些选项的菜单,点击适用的参数旁边。欲了解更多信息,请参阅变压器Parameter Menu Options。
定义值
有几种方法来定义一个变压器使用的值。最简单的是简单地在一个值或字符串,其可包括各种类型,如属性引用,数学和字符串函数,和工作空间参数的函数类型。有许多的工具和快捷方式,可以帮助构建值,一般可从邻近值字段的下拉上下文菜单。
使用文本编辑器
文本编辑器提供了一个方便的方法来构造从各种数据源,如属性,参数和常量,其中该结果被直接使用的参数中的文本字符串(包括正则表达式)。
使用算术编辑器
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
条件值
根据一个或多个测试条件,要么通过或失败的设定值。
内容
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>)不应该被用作文字字符串值。
这些功能操作和格式字符串。 | |
特殊的角色 |
A set of control characters is available in the Text Editor. |
数学函数在两种编辑器中可用。 | |
时间/日期函数 | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
这些收益主要功能特定的值。 | |
FME和workspace-specific parameters may be used. | |
创建和修改用户参数 | 创建您自己的可编辑参数。 |
对话框选项 - 表
变压器s with table-style parameters have additional tools for populating and manipulating values.
Row Reordering |
Enabled once you have clicked on a row item. Choices include:
|
剪下 |
Enabled once you have clicked on a row item. Choices include:
剪下可以变压器内使用,或变压器之间。 |
Filter |
开始输入字符串,和所述矩阵将仅显示行匹配这些字符。搜索所有列。这不仅影响了变压器中的属性的显示 - 它不会改变其属性输出。 |
Import |
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
重置/刷新 |
通常,表复位到它的初始状态,并且可以提供附加选项以去除无效项。行为变压器之间变化。 |
注意:并非所有的工具都在所有的变压器可用。
Reference
加工行为 |
不适用 |
特点控股 |
不适用 |
依赖 | 格式依赖性 - 可能需要一些格式的第三方驱动程序 |
FME许可级别 | FME专业版及以上 |
别名 | |
历史 |
FME社亚搏国际在线官网区
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
搜索有关SQLCreator所有结果在FME社区。亚搏国际在线官网
Examples may contain information licensed under the Open Government Licence – Vancouver