Microsoft SQL Server and Azure SQL Database Spatial Reader Parameters

About Database Connections

Database formats include a Database Connection parameter that defines and stores authentication information. For general information about sharing database connections, please see Using Database Connections.

Note that Database Connection parameters differ slightly, depending on context and/or database format.

Connection

From the Connection parameter in a database format, you can do one of the following:

  • Select an existing, previously defined connection. See the section Reusing a Database Connection in Using Database Connections
  • Select Add Database Connection to define a new connection. See database-specific parameters below, as well as the section Adding a Database Connection in a Workspace in Using Database Connections The new connection can be made visible only to the current user, or can be shared among multiple users.

Connection Parameters (Add Database Connection dialog)

Username and Password

Enter the username and password to access the service.

Constraints

Tables

After specifying the database connection, click the Browse button (...) to select tables for import. A connection window appears while the system retrieves the tables from the database.

Once the Select Tables dialog appears, you can select one or more tables. Click OK to dismiss the window and add the selected table name(s) to the Tables parameter.

WHERE Clause

This parameter is used to constrain the row selection in tables chosen in the Tables parameter (for example, NUMLANES=2, LENGTH > 2000).

To construct a WHERE clause, click the browse button to open the editor. (You can also type a WHERE clause directly in the parameter field.)

If the WHERE clause SQL is invalid, the translation will fail.

Advanced

Application Intent

Declares the application workload type when connecting to a server in an Always On environment.

  • ReadWrite (default) – The driver connects to a read-write node.
  • ReadOnly – The client requests a read workload when connecting. The server enforces the intent at connection time.

Number Of Records To Fetch At A Time

The number of rows that are retrieved at one time into local memory from the data source. For example, if the value is set to 10000, the reader reads 10,000 rows into local memory, and processes features from this memory buffer. After the reading the last row, the reader retrieves the next 10,000 rows from the data source.

Note: If this parameter is incorrectly set, it will cause significantly degraded performance. The optimum value depends primarily on the characteristics of individual records and the transport between the database and the client machine. It is less affected by the quantity of rows that are to be retrieved. The optimal value is the default value set for the format, and these values vary widely (for example, 1 for PostGIS Raster; 10 for Microsoft SQL Server; 10000 for PostGIS and Redshift).

Geometry Columns Have Exactly One SRID

SQL Server does not constrain all geometry objects in a column to have the same Spatial Reference ID (SRID). However, it is common practice to use a single SRID within a given column.

If this parameter is set to No, FME will not assume that each geometry column uses a single SRID when querying the database. If this parameter is not set, the default value is Yes.

Handle Multiple Spatial Columns

If Yes, feature geometry will be read into an aggregate. A directive is set on the aggregate to indicate that each part of the aggregate is independent from the others, and its own geometry. Geometry parts of the aggregate are named and contain geometry according to their respective column in the table being read.

When using this feature, neither the geometry/geography column, nor the feature type SELECT statement can be specified.

Use MakeValid with Search Envelope

This parameter controls whether or not the MakeValid() SQL command will be used when there is a Search Envelope being applied.

  • Yes:MakeValid() will be used. This may cause a slow-down during reading, as the spatial data will validated and possibly corrected.
  • No (default):MakeValid() will not be used. This may speed up reading; however, it may cause the translation to fail if there is invalid data. If a translation fails, setting this parameter to Yes will allow the translation to succeed.

SQL to Run Before Read

This parameter allows for the execution of SQL statements before opening a table for reading. For example, it may be necessary to create a temporary view before attempting to read from it.

For detailed information about SQL functions, click the corresponding menu item in the SQL to Run editor helpClosed.

Available menu options depend on the format.

Multiple SQL commands can be delimited by a character specified using the FME_SQL_DELIMITER directive, embedded at the beginning of the SQL block. The single character following this directive will be used to split the SQL block into SQL statements, which will then be sent to the database for execution. Note: Include a space before the character.

For example:

FME_SQL_DELIMITER ;
DELETE FROM instructors ;
DELETE FROM people
WHERE LastName='Doe' AND FirstName='John'

Multiple delimiters are not allowed and the delimiter character will be stripped before being sent to the database.

Any errors occurring during the execution of these SQL statements will normally terminate the reader or writer (depending on where the SQL statement is executed) with an error. If the specified statement is preceded by a hyphen (“-”), such errors are ignored.

SQL To Run After Read

This parameter allows for the execution of SQL statements after a set of tables has been read. For example, it may be necessary to clean up a temporary view after creating it.

For detailed information about SQL functions, click the corresponding menu item in the SQL to Run editor helpClosed.

Available menu options depend on the format.

Multiple SQL commands can be delimited by a character specified using the FME_SQL_DELIMITER directive, embedded at the beginning of the SQL block. The single character following this directive will be used to split the SQL block into SQL statements, which will then be sent to the database for execution. Note: Include a space before the character.

For example:

FME_SQL_DELIMITER ;
DELETE FROM instructors ;
DELETE FROM people
WHERE LastName='Doe' AND FirstName='John'

Multiple delimiters are not allowed and the delimiter character will be stripped before being sent to the database.

Any errors occurring during the execution of these SQL statements will normally terminate the reader or writer (depending on where the SQL statement is executed) with an error. If the specified statement is preceded by a hyphen (“-”), such errors are ignored.