Matillion Data Model for SendGrid
Version - 21.0.8241.0

Note: If you're using Matillion ETL, we advise you update to the latest version to ensure that your instance is reflective of the information displayed in the data model. This note does not apply to the Data Productivity Cloud.



Connection String OptionsBack To Top

  1. APIKey
  2. SSLServerCert
  3. FirewallType
  4. FirewallServer
  5. FirewallPort
  6. FirewallUser
  7. FirewallPassword
  8. ProxyAutoDetect
  9. ProxyServer
  10. ProxyPort
  11. ProxyAuthScheme
  12. ProxyUser
  13. ProxyPassword
  14. ProxySSLType
  15. ProxyExceptions
  16. Logfile
  17. Verbosity
  18. LogModules
  19. MaxLogFileSize
  20. MaxLogFileCount
  21. Location
  22. BrowsableSchemas
  23. Tables
  24. Views
  25. AutoCache
  26. CacheDriver
  27. CacheConnection
  28. CacheLocation
  29. CacheTolerance
  30. Offline
  31. CacheMetadata
  32. BatchSize
  33. ConnectionLifeTime
  34. ConnectOnOpen
  35. IncludeCustomFields
  36. MaxRows
  37. Other
  38. PoolIdleTimeout
  39. PoolMaxSize
  40. PoolMinSize
  41. PoolWaitTime
  42. PseudoColumns
  43. Readonly
  44. RTK
  45. SupportEnhancedSQL
  46. Timeout
  47. UseConnectionPooling

APIKey

Data Type

string

Default Value

""

Remarks

The API key of the currently authenticated user. Note that it is a manadatory parameter to authenticate through SendGrid driver.



SSLServerCert

Data Type

string

Default Value

""

Remarks

If using a TLS/SSL connection, this property can be used to specify the TLS/SSL certificate to be accepted from the server. Any other certificate that is not trusted by the machine is rejected.

This property can take the following forms:

Description Example
A full PEM Certificate (example shortened for brevity) -----BEGIN CERTIFICATE----- MIIChTCCAe4CAQAwDQYJKoZIhv......Qw== -----END CERTIFICATE-----
A path to a local file containing the certificate C:\cert.cer
The public key (example shortened for brevity) -----BEGIN RSA PUBLIC KEY----- MIGfMA0GCSq......AQAB -----END RSA PUBLIC KEY-----
The MD5 Thumbprint (hex values can also be either space or colon separated) ecadbdda5a1529c58a1e9e09828d70e4
The SHA1 Thumbprint (hex values can also be either space or colon separated) 34a929226ae0819f2ec14b4a3d904f801cbb150d

If not specified, any certificate trusted by the machine is accepted.

Certificates are validated as trusted by the machine based on the System's trust store. The trust store used is the 'javax.net.ssl.trustStore' value specified for the system. If no value is specified for this property, Java's default trust store is used (for example, JAVA_HOME\lib\security\cacerts).

Use '*' to signify to accept all certificates. Note that this is not recommended due to security concerns.



FirewallType

Data Type

string

Default Value

"NONE"

Remarks

This property specifies the protocol that the driver will use to tunnel traffic through the FirewallServer proxy. Note that by default, the driver connects to the system proxy; to disable this behavior and connect to one of the following proxy types, set ProxyAutoDetect to false.

Type Default Port Description
TUNNEL 80 When this is set, the driver opens a connection to SendGrid and traffic flows back and forth through the proxy.
SOCKS4 1080 When this is set, the driver sends data through the SOCKS 4 proxy specified by FirewallServer and FirewallPort and passes the FirewallUser value to the proxy, which determines if the connection request should be granted.
SOCKS5 1080 When this is set, the driver sends data through the SOCKS 5 proxy specified by FirewallServer and FirewallPort. If your proxy requires authentication, set FirewallUser and FirewallPassword to credentials the proxy recognizes.

To connect to HTTP proxies, use ProxyServer and ProxyPort. To authenticate to HTTP proxies, use ProxyAuthScheme, ProxyUser, and ProxyPassword.



FirewallServer

Data Type

string

Default Value

""

Remarks

This property specifies the IP address, DNS name, or host name of a proxy allowing traversal of a firewall. The protocol is specified by FirewallType: Use FirewallServer with this property to connect through SOCKS or do tunneling. Use ProxyServer to connect to an HTTP proxy.

Note that the driver uses the system proxy by default. To use a different proxy, set ProxyAutoDetect to false.



FirewallPort

Data Type

int

Default Value

0

Remarks

This specifies the TCP port for a proxy allowing traversal of a firewall. Use FirewallServer to specify the name or IP address. Specify the protocol with FirewallType.



FirewallUser

Data Type

string

Default Value

""

Remarks

The FirewallUser and FirewallPassword properties are used to authenticate against the proxy specified in FirewallServer and FirewallPort, following the authentication method specified in FirewallType.



FirewallPassword

Data Type

string

Default Value

""

Remarks

This property is passed to the proxy specified by FirewallServer and FirewallPort, following the authentication method specified by FirewallType.



ProxyAutoDetect

Data Type

bool

Default Value

false

Remarks

This takes precedence over other proxy settings, so you'll need to set ProxyAutoDetect to FALSE in order use custom proxy settings.

NOTE: When this property is set to True, the proxy used is determined as follows:

To connect to an HTTP proxy, see ProxyServer. For other proxies, such as SOCKS or tunneling, see FirewallType.



ProxyServer

Data Type

string

Default Value

""

Remarks

The hostname or IP address of a proxy to route HTTP traffic through. The driver can use the HTTP, Windows (NTLM), or Kerberos authentication types to authenticate to an HTTP proxy.

If you need to connect through a SOCKS proxy or tunnel the connection, see FirewallType.

By default, the driver uses the system proxy. If you need to use another proxy, set ProxyAutoDetect to false.



ProxyPort

Data Type

int

Default Value

80

Remarks

The port the HTTP proxy is running on that you want to redirect HTTP traffic through. Specify the HTTP proxy in ProxyServer. For other proxy types, see FirewallType.



ProxyAuthScheme

Data Type

string

Default Value

"BASIC"

Remarks

This value specifies the authentication type to use to authenticate to the HTTP proxy specified by ProxyServer and ProxyPort.

Note that the driver will use the system proxy settings by default, without further configuration needed; if you want to connect to another proxy, you will need to set ProxyAutoDetect to false, in addition to ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.

The authentication type can be one of the following:

If you need to use another authentication type, such as SOCKS 5 authentication, see FirewallType.



ProxyUser

Data Type

string

Default Value

""

Remarks

The ProxyUser and ProxyPassword options are used to connect and authenticate against the HTTP proxy specified in ProxyServer.

You can select one of the available authentication types in ProxyAuthScheme. If you are using HTTP authentication, set this to the user name of a user recognized by the HTTP proxy. If you are using Windows or Kerberos authentication, set this property to a user name in one of the following formats:

user@domain

domain\user



ProxyPassword

Data Type

string

Default Value

""

Remarks

This property is used to authenticate to an HTTP proxy server that supports NTLM (Windows), Kerberos, or HTTP authentication. To specify the HTTP proxy, you can set ProxyServer and ProxyPort. To specify the authentication type, set ProxyAuthScheme.

If you are using HTTP authentication, additionally set ProxyUser and ProxyPassword to HTTP proxy.

If you are using NTLM authentication, set ProxyUser and ProxyPassword to your Windows password. You may also need these to complete Kerberos authentication.

For SOCKS 5 authentication or tunneling, see FirewallType.

By default, the driver uses the system proxy. If you want to connect to another proxy, set ProxyAutoDetect to false.



ProxySSLType

Data Type

string

Default Value

"AUTO"

Remarks

This property determines when to use SSL for the connection to an HTTP proxy specified by ProxyServer. This value can be AUTO, ALWAYS, NEVER, or TUNNEL. The applicable values are the following:

AUTODefault setting. If the URL is an HTTPS URL, the driver will use the TUNNEL option. If the URL is an HTTP URL, the component will use the NEVER option.
ALWAYSThe connection is always SSL enabled.
NEVERThe connection is not SSL enabled.
TUNNELThe connection is through a tunneling proxy. The proxy server opens a connection to the remote host and traffic flows back and forth through the proxy.



ProxyExceptions

Data Type

string

Default Value

""

Remarks

The ProxyServer is used for all addresses, except for addresses defined in this property. Use semicolons to separate entries.

Note that the driver uses the system proxy settings by default, without further configuration needed; if you want to explicitly configure proxy exceptions for this connection, you need to set ProxyAutoDetect = false, and configure ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.



Logfile

Data Type

string

Default Value

""

Remarks

Once this property is set, the driver will populate the log file as it carries out various tasks, such as when authentication is performed or queries are executed. If the specified file doesn't already exist, it will be created.

Connection strings and version information are also logged, though connection properties containing sensitive information are masked automatically.

If a relative filepath is supplied, the location of the log file will be resolved based on the path found in the Location connection property.

For more control over what is written to the log file, you can adjust the Verbosity property.

Log contents are categorized into several modules. You can show/hide individual modules using the LogModules property.

To edit the maximum size of a single logfile before a new one is created, see MaxLogFileSize.

If you would like to place a cap on the number of logfiles generated, use MaxLogFileCount.

Java Logging

Java logging is also supported. To enable Java logging, set Logfile to:

Logfile=JAVALOG://myloggername

As in the above sample, JAVALOG:// is a required prefix to use Java logging, and you will substitute your own Logger.

The supplied Logger's getLogger method is then called, using the supplied value to create the Logger instance. If a logging instance already exists, it will reference the existing instance.

When Java logging is enabled, the Verbosity will now correspond to specific logging levels.



Verbosity

Data Type

string

Default Value

"1"

Remarks

The verbosity level determines the amount of detail that the driver reports to the Logfile. Verbosity levels from 1 to 5 are supported. These are detailed in the Logging page.



LogModules

Data Type

string

Default Value

""

Remarks

Only the modules specified (separated by ';') will be included in the log file. By default all modules are included.

See the Logging page for an overview.



MaxLogFileSize

Data Type

string

Default Value

"100MB"

Remarks

When the limit is hit, a new log is created in the same folder with the date and time appended to the end. The default limit is 100 MB. Values lower than 100 kB will use 100 kB as the value instead.

Adjust the maximum number of logfiles generated with MaxLogFileCount.



MaxLogFileCount

Data Type

int

Default Value

-1

Remarks

When the limit is hit, a new log is created in the same folder with the date and time appended to the end and the oldest log file will be deleted.

The minimum supported value is 2. A value of 0 or a negative value indicates no limit on the count.

Adjust the maximum size of the logfiles generated with MaxLogFileSize.



Location

Data Type

string

Default Value

"%APPDATA%\\CData\\SendGrid Data Provider\\Schema"

Remarks

The path to a directory which contains the schema files for the driver (.rsd files for tables and views, .rsb files for stored procedures). The folder location can be a relative path from the location of the executable. The Location property is only needed if you want to customize definitions (for example, change a column name, ignore a column, and so on) or extend the data model with new tables, views, or stored procedures.

If left unspecified, the default location is "%APPDATA%\\CData\\SendGrid Data Provider\\Schema" with %APPDATA% being set to the user's configuration directory:

Platform %APPDATA%
Windows The value of the APPDATA environment variable
Mac ~/Library/Application Support
Linux ~/.config



BrowsableSchemas

Data Type

string

Default Value

""

Remarks

Listing the schemas from databases can be expensive. Providing a list of schemas in the connection string improves the performance.



Tables

Data Type

string

Default Value

""

Remarks

Listing the tables from some databases can be expensive. Providing a list of tables in the connection string improves the performance of the driver.

This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.

Specify the tables you want in a comma-separated list. Each table should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Tables=TableA,[TableB/WithSlash],WithCatalog.WithSchema.`TableC With Space`.

Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.



Views

Data Type

string

Default Value

""

Remarks

Listing the views from some databases can be expensive. Providing a list of views in the connection string improves the performance of the driver.

This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.

Specify the views you want in a comma-separated list. Each view should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Views=ViewA,[ViewB/WithSlash],WithCatalog.WithSchema.`ViewC With Space`.

Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.



AutoCache

Data Type

bool

Default Value

false

Remarks

When AutoCache = true, the driver automatically maintains a cache of your table's data in the database of your choice.

Setting the Caching Database

When AutoCache = true, the driver caches to a simple, file-based cache. You can configure its location or cache to a different database with the following properties:

See Also



CacheDriver

Data Type

string

Default Value

""

Remarks

You can cache to any database for which you have a JDBC driver, including CData JDBC drivers.

The cache database is determined based on the CacheDriver and CacheConnection properties. The CacheDriver is the name of the JDBC driver class that you want to use to cache data.

Note that you must also add the CacheDriver JAR file to the classpath.

The following examples show how to cache to several major databases. Refer to CacheConnection for more information on the JDBC URL syntax and typical connection properties.

Derby and Java DB

The driver simplifies Derby configuration. Java DB is the Oracle distribution of Derby. The JAR file is shipped in the JDK. You can find the JAR file, derby.jar, in the db subfolder of the JDK installation. In most caching scenarios, you need to specify only the following, after adding derby.jar to the classpath:

jdbc:sendgrid:CacheLocation='c:/Temp/cachedir';APIKey=abc123;
To customize the Derby JDBC URL, use CacheDriver and CacheConnection. For example, to cache to an in-memory database, use a JDBC URL like the following:
jdbc:sendgrid:CacheDriver=org.apache.derby.jdbc.EmbeddedDriver;CacheConnection='jdbc:derby:memory';APIKey=abc123;
SQLite

The following is a JDBC URL for the SQLite JDBC driver:

jdbc:sendgrid:CacheDriver=org.sqlite.JDBC;CacheConnection='jdbc:sqlite:C:/Temp/sqlite.db';APIKey=abc123;
MySQL

The following is a JDBC URL for the included CData JDBC Driver for MySQL:

  jdbc:sendgrid:Cache Driver=cdata.jdbc.mysql.MySQLDriver;Cache Connection='jdbc:mysql:Server=localhost;Port=3306;Database=cache;User=root;Password=123456';APIKey=abc123;

  
SQL Server

The following JDBC URL uses the Microsoft JDBC Driver for SQL Server:

jdbc:sendgrid:Cache Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver;Cache Connection='jdbc:sqlserver://localhost\sqlexpress:7437;user=sa;password=123456;databaseName=Cache';APIKey=abc123;
Oracle

The following is a JDBC URL for the Oracle Thin Client:

jdbc:sendgrid:Cache Driver=oracle.jdbc.OracleDriver;CacheConnection='jdbc:oracle:thin:scott/tiger@localhost:1521:orcldb';APIKey=abc123;
NOTE: If using a version of Oracle older than 9i, the cache driver will instead be oracle.jdbc.driver.OracleDriver .
PostgreSQL

The following JDBC URL uses the official PostgreSQL JDBC driver:

jdbc:sendgrid:CacheDriver=cdata.jdbc.postgresql.PostgreSQLDriver;CacheConnection='jdbc:postgresql:User=postgres;Password=admin;Database=postgres;Server=localhost;Port=5432;';APIKey=abc123;



CacheConnection

Data Type

string

Default Value

""

Remarks

The cache database is determined based on the CacheDriver and CacheConnection properties. Both properties are required to use the cache database. Examples of common cache database settings can be found below. For more information on setting the caching database's driver, refer to CacheDriver.

The connection string specified in the CacheConnection property is passed directly to the underlying CacheDriver. Consult the documentation for the specific JDBC driver for more information on the available properties. Make sure to include the JDBC driver in your application's classpath.

Derby and Java DB

The driver simplifies caching to Derby, only requiring you to set the CacheLocation property to make a basic connection.

Alternatively, you can configure the connection to Derby manually using CacheDriver and CacheConnection. The following is the Derby JDBC URL syntax:

jdbc:derby:[subsubprotocol:][databaseName][;attribute=value[;attribute=value] ... ]
For example, to cache to an in-memory database, use the following:
jdbc:derby:memory

SQLite

To cache to SQLite, you can use the SQLite JDBC driver. The following is the syntax of the JDBC URL:

jdbc:sqlite:dataSource

MySQL

The installation includes the CData JDBC Driver for MySQL. The following is an example JDBC URL:

jdbc:mysql:User=root;Password=root;Server=localhost;Port=3306;Database=cache
The following are typical connection properties:

SQL Server

The JDBC URL for the Microsoft JDBC Driver for SQL Server has the following syntax:

jdbc:sqlserver://[serverName[\instance][:port]][;database=databaseName][;property=value[;property=value] ... ]
For example:
jdbc:sqlserver://localhost\sqlexpress:1433;integratedSecurity=true
The following are typical SQL Server connection properties:
Oracle

The following is the conventional JDBC URL syntax for the Oracle JDBC Thin driver:

jdbc:oracle:thin:[userId/password]@[//]host[[:port][:sid]]
For example:
jdbc:oracle:thin:scott/tiger@myhost:1521:orcl
The following are typical connection properties:
PostgreSQL

The following is the JDBC URL syntax for the official PostgreSQL JDBC driver:

jdbc:postgresql:[//[host[:port]]/]database[[?option=value][[&option=value][&option=value] ... ]]
For example, the following connection string connects to a database on the default host (localhost) and port (5432):
jdbc:postgresql:postgres
The following are typical connection properties:



CacheLocation

Data Type

string

Default Value

"%APPDATA%\\CData\\SendGrid Data Provider"

Remarks

The CacheLocation is a simple, file-based cache. The driver uses Java DB, Oracle's distribution of the Derby database. To cache to Java DB, you will need to add the Java DB JAR file to the classpath. The JAR file, derby.jar, is shipped in the JDK and located in the db subfolder of the JDK installation.

If left unspecified, the default location is "%APPDATA%\\CData\\SendGrid Data Provider" with %APPDATA% being set to the user's configuration directory:

Platform %APPDATA%
Windows The value of the APPDATA environment variable
Mac ~/Library/Application Support
Linux ~/.config

See Also



CacheTolerance

Data Type

int

Default Value

600

Remarks

The tolerance for stale data in the cache specified in seconds. This only applies when AutoCache is used. The driver checks with the data source for newer records after the tolerance interval has expired. Otherwise, it returns the data directly from the cache.



Offline

Data Type

bool

Default Value

false

Remarks

When Offline = true, all queries execute against the cache as opposed to the live data source. In this mode, certain queries like INSERT, UPDATE, DELETE, and CACHE are not allowed.



CacheMetadata

Data Type

bool

Default Value

false

Remarks

As you execute queries with this property set, table metadata in the SendGrid catalog are cached to the file store specified by CacheLocation if set or the user's home directory otherwise. A table's metadata will be retrieved only once, when the table is queried for the first time.

When to Use CacheMetadata

The driver automatically persists metadata in memory for up to two hours when you first discover the metadata for a table or view and therefore, CacheMetadata is generally not required. CacheMetadata becomes useful when metadata operations are expensive such as when you are working with large amounts of metadata or when you have many short-lived connections.

When Not to Use CacheMetadata



BatchSize

Data Type

int

Default Value

0

Remarks

When BatchSize is set to a value greater than 0, the batch operation will split the entire batch into separate batches of size BatchSize. The split batches will then be submitted to the server individually. This is useful when the server has limitations on the size of the request that can be submitted.

Setting BatchSize to 0 will submit the entire batch as specified.



ConnectionLifeTime

Data Type

int

Default Value

0

Remarks

The maximum lifetime of a connection in seconds. Once the time has elapsed, the connection object is disposed. The default is 0 which indicates there is no limit to the connection lifetime.



ConnectOnOpen

Data Type

bool

Default Value

false

Remarks

When set to true, a connection will be made to SendGrid when the connection is opened. This property enables the Test Connection feature available in various database tools.

This feature acts as a NOOP command as it is used to verify a connection can be made to SendGrid and nothing from this initial connection is maintained.

Setting this property to false may provide performance improvements (depending upon the number of times a connection is opened).



IncludeCustomFields

Data Type

bool

Default Value

true

Remarks

Setting this to true will cause custom fields to be included in the column listing, but may cause poor performance when listing metadata.



MaxRows

Data Type

int

Default Value

-1

Remarks

Limits the number of rows returned rows when no aggregation or group by is used in the query. This helps avoid performance issues at design time.



Other

Data Type

string

Default Value

""

Remarks

The properties listed below are available for specific use cases. Normal driver use cases and functionality should not require these properties.

Specify multiple properties in a semicolon-separated list.

Caching Configuration

CachePartial=TrueCaches only a subset of columns, which you can specify in your query.
QueryPassthrough=TruePasses the specified query to the cache database instead of using the SQL parser of the driver.

Integration and Formatting

DefaultColumnSizeSets the default length of string fields when the data source does not provide column length in the metadata. The default value is 2000.
ConvertDateTimeToGMTDetermines whether to convert date-time values to GMT, instead of the local time of the machine.
RecordToFile=filenameRecords the underlying socket data transfer to the specified file.



PoolIdleTimeout

Data Type

int

Default Value

60

Remarks

The allowed idle time a connection can remain in the pool until the connection is closed. The default is 60 seconds.



PoolMaxSize

Data Type

int

Default Value

100

Remarks

The maximum connections in the pool. The default is 100. To disable this property, set the property value to 0 or less.



PoolMinSize

Data Type

int

Default Value

1

Remarks

The minimum number of connections in the pool. The default is 1.



PoolWaitTime

Data Type

int

Default Value

60

Remarks

The max seconds to wait for a connection to become available. If a new connection request is waiting for an available connection and exceeds this time, an error is thrown. By default, new requests wait forever for an available connection.



PseudoColumns

Data Type

string

Default Value

""

Remarks

This setting is particularly helpful in Entity Framework, which does not allow you to set a value for a pseudo column unless it is a table column. The value of this connection setting is of the format "Table1=Column1, Table1=Column2, Table2=Column3". You can use the "*" character to include all tables and all columns; for example, "*=*".



Readonly

Data Type

bool

Default Value

false

Remarks

If this property is set to true, the driver will allow only SELECT queries. INSERT, UPDATE, DELETE, and stored procedure queries will cause an error to be thrown.



RTK

Data Type

string

Default Value

""

Remarks

The RTK property may be used to license a build. See the included licensing file to see how to set this property. The runtime key is only available if you purchased an OEM license.



SupportEnhancedSQL

Data Type

bool

Default Value

true

Remarks

When SupportEnhancedSQL = true, the driver offloads as much of the SELECT statement processing as possible to SendGrid and then processes the rest of the query in memory. In this way, the driver can execute unsupported predicates, joins, and aggregation.

When SupportEnhancedSQL = false, the driver limits SQL execution to what is supported by the SendGrid API.

Execution of Predicates

The driver determines which of the clauses are supported by the data source and then pushes them to the source to get the smallest superset of rows that would satisfy the query. It then filters the rest of the rows locally. The filter operation is streamed, which enables the driver to filter effectively for even very large datasets.

Execution of Joins

The driver uses various techniques to join in memory. The driver trades off memory utilization against the requirement of reading the same table more than once.

Execution of Aggregates

The driver retrieves all rows necessary to process the aggregation in memory.



Timeout

Data Type

int

Default Value

60

Remarks

If Timeout = 0, operations do not time out. The operations run until they complete successfully or until they encounter an error condition.

If Timeout expires and the operation is not yet complete, the driver throws an exception.



UseConnectionPooling

Data Type

bool

Default Value

false

Remarks

This property enables connection pooling. The default is false. See Connection Pooling for information on using connection pools.





TablesBack To Top

  1. Alerts
  2. ApiKeys
  3. Bounces
  4. CancelScheduledSends
  5. CustomFields
  6. GlobalUnsubscribes
  7. InvalidEmails
  8. Lists
  9. MarketingCampaigns
  10. NMCCustomFields
  11. NMCLists
  12. NMCSegments
  13. NMCSenders
  14. NMCSingleSends
  15. Recipients
  16. Schedules
  17. Segments
  18. SenderIdentities
  19. Spam
  20. Teammates
  21. UnsubscribeGroups

Alerts

Create, update, delete, and query Alerts in SendGrid.

Table-Specific Information

Select

This table only supports filtering by Id. The following are the only possible SELECT queries:

SELECT * FROM Alerts

SELECT * FROM Alerts WHERE Id = '148825'



Columns

Name Type ReadOnly Description
Id [KEY] Integer False

The ID of the alert.

CreatedAt Datetime True

Date when the alert was created.

UpdatedAt Datetime True

Date when the alert was updated.

EmailTo String False

The email address that the alert will be sent to.

Percentage Integer False

The email address that the alert will be sent to.

Type String False

The type of alert. Allowed values (usage_limit, stats_notification).

Frequency String False

If the alert is of type stats_notification, this indicates how frequently the stats notifications will be sent.(daily, weekly, monthly).



ApiKeys

Query, Create, Update and Delete the available ApiKeys in SendGrid.

Table-Specific Information
Select

To get all the Api Keys

SELECT * FROM ApiKeys

To get information about a specific Api Key

SELECT * FROM Apikeys WHERE ApiKeyId='Dqdvdvdvdv4yLeuVQqO3rFxN5ktUxA'



Columns

Name Type ReadOnly Description
ApiKeyId [KEY] String False

The ID of your API Key.

Name String False

The name of your API Key.

Scopes String False

The permissions this API Key has access to.



Bounces

Query and Delete the available Bounces in SendGrid.

Table-Specific Information
Select

You need to specify a time span to select from this table. If you do not specify one, a default span of the past 120 days is used. The CreatedAt column supports the >, <, =, <=, and >= operators.

SELECT * FROM Bounces WHERE CreatedAt > '2016-01-01' AND CreatedAt < '2016-01-30'

Columns

Name Type ReadOnly Description
CreatedAt Datetime True

The time the bounce was created.

Reason String False

The reason for the bounce.

Email [KEY] String False

The email that bounced.

Status String False

The enhanced SMTP bounce response.



CancelScheduledSends

Update, delete, and query Cancel Scheduled Sends in SendGrid.

Table-Specific Information

Select

This table only supports filtering by BatchId. The following are the only possible SELECT queries:

SELECT * FROM CancelScheduledSends

SELECT * FROM CancelScheduledSends WHERE BatchId = 148825


Columns

Name Type ReadOnly Description
BatchId [KEY] String False

The Id of the batch.

Status String False

The status of the scheduled send.Allowed Values: cancel, pause



CustomFields

Create, delete, and query Custom Fields in SendGrid.

Table Specific Information

Custom fields are filters for a Recipient that are defined by the user.

Select

You can retrieve all the CustomFields or filter them by Id:

SELECT * FROM CustomFields

SELECT * FROM CustomFields WHERE Id = '1'

Use quotations to filter on Custom Fields regardless of type.


Columns

Name Type ReadOnly Description
Id [KEY] String False

The Id of the custom field.

Name String False

The name of the custom field.

Type String False

The type of the custom field. Allowed values are number, text, or date.



GlobalUnsubscribes

Query Global Unsubscribes in SendGrid.

Table-Specific Information
Select

You need to specify a time span to select from this table. However this filter is optional. The CreatedAt column supports the >, <, =, <=, and >= operators.

SELECT * FROM GlobalUnsubscribes WHERE CreatedAt > '2016-01-01' AND CreatedAt < '2016-01-30'
INSERT

Performing an Insert operation in this table you need to specify an email which will be added to the GlobalUnsubscribes list. For example:

INSERT INTO GlobalUnsubscribes (Email) VALUES ('test@test.com')
DELETE

Performing a Delete operation in this table you need to specify an email which will be removed from the GlobalUnsubscribes list. For example:

DELETE FROM GlobalUnsubscribes WHERE Email = 'test@test.com'
Columns

Name Type ReadOnly Description
Email [KEY] String False

Email of the unsubscriber.

CreatedAt Datetime True

The time the unsubscriber was created.



InvalidEmails

Query and Delete invalid emails in SendGrid.

Table-Specific Information

Select

This table only supports filtering by Email. The following are the only possible SELECT queries:

SELECT * FROM InvalidEmails

SELECT * FROM InvalidEmails WHERE Email = 'test@test.com'

Columns

Name Type ReadOnly Description
Created Datetime True

The time the when the email address was added to the invalid emails list.

Reason String False

A reason explaining why the email address was marked as invalid..

Email String False

The email address that was marked as invalid.



Lists

Create, update, delete, and query the available Lists in SendGrid.

Table-Specific Information

Select

The Lists table can only filtered by its Id.

SELECT * FROM Lists WHERE Id = '123'



Columns

Name Type ReadOnly Description
Id [KEY] Integer True

The Id of the list.

Name String False

The name of the list.

RecipientCount Integer True

The recipient count of the list.



MarketingCampaigns

Create, update, delete, and query Marketing Campaigns in SendGrid.

Table-Specific Information

Select

This table only supports filtering by Id. The following are the only possible SELECT queries:

SELECT * FROM MarketingCampaigns

SELECT * FROM MarketingCampaigns WHERE Id = '1'



Columns

Name Type ReadOnly Description
Id [KEY] String True

The Id of the marketing campaign.

Title String False

The title of the marketing campaign.

Subject String False

The subject of the marketing campaign.

SenderId Integer False

The sender Ids of the marketing campaign, separated by a comma.

ListIds String False

The list of list Ids of the marketing campaign, separated by a comma.

SegmentIds String False

The list of segment Ids of the marketing campaign, separated by a comma.

Categories String False

The categories of the marketing campaign.

SuppressionGroupId Integer False

The suppression group Id of the marketing campaign.

CustomUnsubscribeUrl String False

The custom unsubscribe URL of the marketing campaign.

IpPool String False

The IP pool of the marketing campaign.

HtmlContent String False

The HTML content of the marketing campaign.

PlainContent String False

The content of the marketing campaign.

Status String True

The status of the marketing campaign.



NMCCustomFields

Create, delete, and query New Marketing Campaign Custom Fields in SendGrid.

Table Specific Information

New Marketing Campaign Custom fields are filters for a Contact that are defined by the user. NMC prefix stands for New Marketing Campaign.

Select

You can retrieve all the NMCCustomFields or filter them by Id:

SELECT * FROM NMCCustomFields

SELECT * FROM NMCCustomFields WHERE Id = '1'

Use quotations to filter on NMC Custom Fields regardless of type.


Columns

Name Type ReadOnly Description
Id [KEY] String True

The Id of the custom field.

Name String False

The name of the custom field.

Type String False

The type of the custom field. Allowed values are number, text, or date.



NMCLists

Create, update, delete, and query the available New Marketing Campaign Lists in SendGrid.

Table-Specific Information

NMC prefix stands for New Marketing Campaign.

Select

The NMCLists table can only filtered by its Id.

SELECT * FROM NMCLists WHERE Id = '123'



Columns

Name Type ReadOnly Description
Id [KEY] String True

The Id of the list.

Name String False

The name of the list.

ContactCount Integer True

The recipient count of the list.



NMCSegments

Create, update, delete, and query New Marketing Campaign Segments in SendGrid.

Table-Specific Information

NMC prefix stands for New Marketing Campaign.

Select

You can retrieve all the segments or filter them by Id.

SELECT * FROM NMCSegments

SELECT * FROM NMCSegments WHERE Id = '1'



Columns

Name Type ReadOnly Description
Id [KEY] String True

The Id of the segment.

Name String False

The name of the segment.

ParentListId String False

The Id of the list associated with the segment.

ContactsCount Integer True

The recipient count of the segment.

CreatedAt Datetime True

Field name for the first condition.

SampleUpdatedAt Datetime False

Field name for the first condition.

UpdatedAt Datetime True

Field name for the first condition.

QueryDSL String False

Field name for the first condition.

NextSampleUpdate Datetime True

The last updated samples date.



NMCSenders

Create, update, delete, and query New Marketing Campaign Senders in SendGrid.

Table-Specific Information

NMC stands for New Marketing Campaign.

Select

This table only supports filtering by Id. The following are the only possible SELECT queries:

SELECT * FROM NMCSenders

SELECT * FROM NMCSenders WHERE Id = '148825'



Columns

Name Type ReadOnly Description
Id [KEY] Integer True

The unique identifier of the sender identity.

Nickname String False

A nickname for the sender identity. Not used for sending..

FromEmail String False

This is where the email will appear to originate from for your recipient.

FromName String False

This is the name appended to the from email field. IE - Your name or company name.

ReplytoEmail String False

This is the email that your recipient will reply to.

ReplytoName String False

This is the name appended to the reply to email field. IE - Your name or company name.

Address String False

The physical address of the sender identity.

Address2 String False

Additional sender identity address information.

City String False

The city of the sender identity.

State String False

The state of the sender identity.

Zip String False

The zipcode of the sender identity.

Locked String False

Indicator if the sender is locked.

VerifiedStatus String False

Verified status of the sender.

VerifiedReason String False

Verified reason of the sender.

Country String False

The country of the sender identity.

CreatedAt Datetime True

The end of the time range when the bounce was created.

UpdatedAt Datetime True

The end of the time range when the bounce was created.



NMCSingleSends

Create, update, delete, and query the available New Marketing Campaign Single Sends in SendGrid.

Table-Specific Information

NMC stands for New Marketing Campaign.

Select

This table only supports filtering by Id. The following are the only possible SELECT queries:

SELECT * FROM NMCSingleSends

SELECT * FROM NMCSingleSends WHERE Id = '148825'



Columns

Name Type ReadOnly Description
Id [KEY] String True

The Id of the single send.

Name String False

The name of the single send.

Status String False

The status of the single send.

CreatedAt String True

The created timestamp of the single send.

UpdatedAt String True

The updated timestamp of the single send.

IsABTest Boolean False

Indicator showing if the single send is an AB Test.

SenderId Integer False

The ID of the verified sender identity.

CustomUnsubscribeUrl String False

The URL allowing contacts to unsubscribe.

SuppressionGroupId Integer False

The ID of the suppression group to allow customers to unsubscribe.

SendAt Datetime False

The ISO 8601 time at which to send the single send.

TemplateId String False

Id of the template used.

IpPool String False

The name of the IP pool from which the single send emails appear to be sent.



Recipients

The SendGrid table Recipients.

Table Specific Information

SendGrid has the ability to categorize Recipients with filters defined by the user. Accordingly, you can execute statements to the Recipients table to search by and insert these filters. However, these filters are reported as attributes of the Custom Fields table.

Select

The following query retrieves only the default fields of the Recipients table, not the Custom Fields that you have created. To retrieve the values of the Custom Fields of a Recipient, query the Custom Fields table.

SELECT * FROM Recipients

You can also retrieve all Recipients inside a certain List or a Segment, but it is not possible to filter by both. Use multiple queries instead:

SELECT * FROM Recipients WHERE SegmentId = '1'

SELECT * FROM Recipients WHERE ListId = '2'

You can build criteria depending on a Custom Field. When querying use quotations regardless of type.This kind of filtering is done client side. In this case Age is a CustomField created by the user.

SELECT * FROM Recipients WHERE Age = '30'



Columns

Name Type ReadOnly Description
Id [KEY] String False

This column is dynamic and maps to the corresponding field in the API.

SegmentId Int32 False

This column is dynamic and maps to the corresponding field in the API.

ListId Int32 False

This column is dynamic and maps to the corresponding field in the API.

Email String False

This column is dynamic and maps to the corresponding field in the API.

FirstName String False

This column is dynamic and maps to the corresponding field in the API.

LastName String False

This column is dynamic and maps to the corresponding field in the API.

CreatedAt Datetime True

This column is dynamic and maps to the corresponding field in the API.

LastClicked Datetime True

This column is dynamic and maps to the corresponding field in the API.

LastEmailed Datetime False

This column is dynamic and maps to the corresponding field in the API.

LastOpened Datetime True

This column is dynamic and maps to the corresponding field in the API.

UpdatedAt Datetime True

This column is dynamic and maps to the corresponding field in the API.

Age String False

This column is dynamic and maps to the corresponding field in the API.

Department String False

This column is dynamic and maps to the corresponding field in the API.

University String False

This column is dynamic and maps to the corresponding field in the API.

The SendGrid table Recipients.

Table Specific Information

SendGrid has the ability to categorize Recipients with filters defined by the user. Accordingly, you can execute statements to the Recipients table to search by and insert these filters. However, these filters are reported as attributes of the Custom Fields table.

Select

The following query retrieves only the default fields of the Recipients table, not the Custom Fields that you have created. To retrieve the values of the Custom Fields of a Recipient, query the Custom Fields table.

SELECT * FROM Recipients

You can also retrieve all Recipients inside a certain List or a Segment, but it is not possible to filter by both. Use multiple queries instead:

SELECT * FROM Recipients WHERE SegmentId = '1'

SELECT * FROM Recipients WHERE ListId = '2'

You can build criteria depending on a Custom Field. When querying use quotations regardless of type.This kind of filtering is done client side. In this case Age is a CustomField created by the user.

SELECT * FROM Recipients WHERE Age = '30'
Insert

To insert into Recipients Email is required.

You can insert Custom Fields into the Recipients table. See the CustomFields section for more information about how to create custom fields.

INSERT INTO Recipients(Email, FirstName, LastName, Age, Department ... Other Custom Fields as necessary) VALUES('email@domain.com', 'name' ,'surname', '30', 'Education' ... Other Custom Field values)
Update

You can only update from this table by specifying an Id. Additionally, the Email column cannot be updated.

UPDATE Recipients SET Age = '12' WHERE Id = '1'
Delete

You can only delete from this table by specifying an Id.

DELETE FROM Recipients WHERE Id = '1'
Columns

Name Type Description
Id [KEY] String This column is dynamic and maps to the corresponding field in the API.
AddressLine1 String This column is dynamic and maps to the corresponding field in the API.
AddressLine2 String This column is dynamic and maps to the corresponding field in the API.
City String This column is dynamic and maps to the corresponding field in the API.
Country String This column is dynamic and maps to the corresponding field in the API.
PostalCode String This column is dynamic and maps to the corresponding field in the API.
StateProvinceRegion String This column is dynamic and maps to the corresponding field in the API.
Line String This column is dynamic and maps to the corresponding field in the API.
Facebook String This column is dynamic and maps to the corresponding field in the API.
PhoneNumber String This column is dynamic and maps to the corresponding field in the API.
UniqueName String This column is dynamic and maps to the corresponding field in the API.
WhatsApp String This column is dynamic and maps to the corresponding field in the API.
Email String This column is dynamic and maps to the corresponding field in the API.
FirstName String This column is dynamic and maps to the corresponding field in the API.
LastName String This column is dynamic and maps to the corresponding field in the API.
CreatedAt Datetime This column is dynamic and maps to the corresponding field in the API.
UpdatedAt Datetime This column is dynamic and maps to the corresponding field in the API.

Pseudo-Columns

Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.

Name Type Description
SegmentId String This column is dynamic and maps to the corresponding field in the API.
ListId String This column is dynamic and maps to the corresponding field in the API.



Schedules

Create, update, delete, and query Campaign Schedules in SendGrid.

Table-Specific Information

Select

You can only retrieve Schedules by providing a MarketingCampaignId.

SELECT * FROM Schedules WHERE MarketingCampaignId = '123'



Columns

Name Type ReadOnly Description
MarketingCampaignId [KEY] Integer True

Id of the campaign.

Status String True

Status of the campaign.

SendAt Datetime False

Date to start the campaign.



Segments

Create, update, delete, and query Segments in SendGrid.

Table-Specific Information

Select

You can retrieve all the segments or filter them by Id.

SELECT * FROM Segments

SELECT * FROM Segments WHERE Id = '1'



Columns

Name Type ReadOnly Description
Id [KEY] Integer True

The Id of the segment.

Name String False

The name of the segment.

ListId Integer False

The Id of the list associated with the segment.

RecipientCount Integer True

The recipient count of the segment.

ConditionsField1 String False

Field name for the first condition.

ConditionsValue1 String False

Field value for the first condition.

ConditionsOperator1 String False

Condition operator for the first condition.

ConditionsAndOr1 String False

How to connect to the previous condition. Allowed values are AND or OR.

ConditionsField2 String False

Field name for the second condition.

ConditionsValue2 String False

Field value for the second condition.

ConditionsOperator2 String False

Condition operator for the second condition.

ConditionsAndOr2 String False

How to connect to the previous condition. Allowed values are AND or OR.

ConditionsField3 String False

Field name for the third condition.

ConditionsValue3 String False

Field value for the third condition.

ConditionsOperator3 String False

Condition operator for the third condition.

ConditionsAndOr3 String False

How to connect to the previous condition. Allowed values are AND or OR.

ConditionsField4 String False

Field name for the fourth condition.

ConditionsValue4 String False

Field value for the fourth condition.

ConditionsOperator4 String False

Condition operator for the fourth condition.

ConditionsAndOr4 String False

How to connect to the previous condition. Allowed values are AND or OR.

ConditionsField5 String False

Field name for the fifth condition.

ConditionsValue5 String False

Field value for the fifth condition.

ConditionsOperator5 String False

Condition operator for the fifth condition.

ConditionsAndOr5 String False

How to connect to the previous condition. Allowed values are AND or OR.



SenderIdentities

Create, update, delete, and query Sender Identities in SendGrid.

Table-Specific Information

Select

This table only supports filtering by Id. The following are the only possible SELECT queries:

SELECT * FROM SenderIdentities

SELECT * FROM SenderIdentities WHERE Id = '148825'



Columns

Name Type ReadOnly Description
Id [KEY] Integer False

The unique identifier of the sender identity.

Nickname String False

A nickname for the sender identity. Not used for sending..

FromEmail String False

This is where the email will appear to originate from for your recipient.

FromName String False

This is the name appended to the from email field. IE - Your name or company name.

ReplytoEmail String False

This is the email that your recipient will reply to.

ReplytoName String False

This is the name appended to the reply to email field. IE - Your name or company name.

Address String False

The physical address of the sender identity.

Address2 String False

Additional sender identity address information.

City String False

The city of the sender identity.

State String False

The state of the sender identity.

Zip String False

The zipcode of the sender identity.

Country String False

The country of the sender identity.

CreatedAt Datetime True

The end of the time range when the bounce was created.

UpdatedAt Datetime True

The end of the time range when the bounce was created.



Spam

Query and delete Spam reports in SendGrid.

Table-Specific Information

Select

This table only supports filtering by Email. The following are the only possible SELECT queries:

SELECT * FROM Spam

SELECT * FROM Spam WHERE Email = 'test@test.com'

Columns

Name Type ReadOnly Description
CreatedAt Datetime True

The time when the spam report was made.

Email [KEY] String False

The email address of the recipient who marked your message as spam..

Ip String False

The IP address that the message was sent on.



Teammates

Query Teammates in SendGrid.

View-Specific Information

Select
The driver will use the SendGrid API to process WHERE clause conditions built with the following column and operator. The rest of the filter is executed client side within the driver.

For example, the following queries are processed server side:

SQL

SELECT * FROM Teammates WHERE Username = 'test'



SELECT * FROM Teammates WHERE Username IN ('test','test2')



Columns

Name Type ReadOnly Description
Username [KEY] String False

The username of the teammate.

Email String False

Email of the teammate.

FirstName String False

First name of the teammate.

LastName String False

Last name of the teammate.

UserType String False

User type of the teammate.

IsAdmin Boolean False

Indicator if the teammate is admin.

Phone String False

Phone of the teammate.

Website String False

Website of the teammate.

Company String False

Company of the teammate.

Address String False

Address of the teammate.

Address2 String False

Address 2 of the teammate.

City String False

City of the teammate.

State String False

State of the teammate.

Country String False

Country of the teammate.

Zip String False

Zip of the teammate.

Scopes String False

Scope of the permissions for the new teammate. Multiple values are allowed and should be split by a comma symbol. Possible values are: user.account.read,user.credits.read,user.email.create,user.email.read,user.email.update,user.email.delete,user.profile.create,user.profile.read,user.profile.update,user.profile.delete



UnsubscribeGroups

Create, update, delete, and query Unsubscribe Groups in SendGrid.

Table-Specific Information

Select

UnsubscribeGroups can only be filtered by Id.

SELECT * FROM UnsubscribeGroups WHERE Id = '1'



Columns

Name Type ReadOnly Description
Id [KEY] Integer True

Id of the unsubscribe group.

Name String False

The name of the unsubscribe group.

Description String False

The description of the unsubscribe group.

LastEmailSentAt Datetime True

The last time an email was sent to the unsubscribe group.

IsDefault Boolean False

If the unsubscribe group is the default group or not.

Unsubscribes Integer True

The number of unsubscribes from this group.





ViewsBack To Top

  1. AdvancedStats
  2. Categories
  3. CategoryStats
  4. GlobalStats
  5. GroupSuppressions
  6. IPAccessManagement
  7. MessageEvents
  8. Messages
  9. Recipients
  10. NMCReservedFields
  11. ReservedFields
  12. SubuserStats
  13. Users

AdvancedStats

Query Advanced Statistics in SendGrid.

View-Specific Information
Select

By default, the Type of the statistics retrieved is Geo. Additionally, you need to specify a time span to select from this table. If you do not specify one, a default span of the past 1 year is used. The Date column supports the >, <, =, <=, and >= operators.

SELECT * FROM AdvancedStats'

SELECT * FROM AdvancedStats WHERE Date > '2016-01-01' AND Date < '2016-03-30'

To query email statistics by browser.

SELECT * FROM AdvancedStats WHERE Type='browser'

To query Email Statistics for Categories, name of the category is required.

SELECT * FROM AdvancedStats WHERE Type='category' AND Name='news'

To query email statistics by device type.

SELECT * FROM AdvancedStats WHERE Type='device'
Columns

Name Type Description
Type String The type of the statistic. Avaible values (categorie, device, client, mailbox_provider, browser, subuser)
Name String The name of the statistic.
Date Date The time the global statistic was created.
Blocks Integer The number of emails that were not allowed to be delivered by ISPs.
Drops Integer The number of emails automatically dropped by SendGrid because they appear on one of the suppression lists.
Bounces Integer The number of emails that bounced instead of being delivered.
Clicks Integer The number of links clicked in your emails.
Deferred Integer The number of emails temporarily refused by the receiving server.
Delivered Integer The number of emails confirmed delivered.
InvalidEmails Integer The number of emails with a malformed address or reported as invalid by the receiving server.
Opens Integer The number of times your emails were opened by recipients.
Processed Integer The number of emails pushed to SendGrid.
Requests Integer The number of emails you requested to send via SendGrid.
SpamReportDrops Integer The number of emails automatically dropped because the emails were marked as spam by the recipient.
SpamReports Integer The number of emails marked as spam by recipients.
UniqueClicks Integer The number of unique recipients who clicked links in your emails.
UniqueOpens Integer The number of unique recipients who opened your emails.
UnsubscribeDrops Integer The number of emails in this category dropped by SendGrid because the recipient unsubscribed from your emails.
Unsubscribes Integer The number of recipients who unsubscribed from your emails.



Categories

Query the available Categories in SendGrid.

View-Specific Information

Select

Query this table to get available categories in SendGrid.

SELECT * FROM Categories
Columns

Name Type Description
Name String The name of the categorie.



CategoryStats

Query the available Category Stats in SendGrid.

View-Specific Information
Select

To query CategoryStats provide the Name of the category you want the statistics for. To find the available category names you can query from the Categories view.

 

SELECT * FROM CategoryStats WHERE Name = 'news'

You can also filter by Date. If you do not specify one, a default span of the past 1 year is used. The operators =, >=, <=, <, and > are supported for this column.

SELECT * FROM CategoryStats WHERE Name = 'news' AND Date > '2016-01-01' AND Date < '2016-01-30'
Columns

Name Type Description
Type String The type of the statistic.
Name String The name of the category.
Date Date The time the global statistic was created.
Blocks Integer The number of emails that were not allowed to be delivered by ISPs.
Drops Integer The number of emails automatically dropped by SendGrid because they appear on one of the suppression lists.
Bounces Integer The number of emails that bounced instead of being delivered.
Clicks Integer The number of links clicked in your emails.
Deferred Integer The number of emails temporarily refused by the receiving server.
Delivered Integer The number of emails confirmed delivered.
InvalidEmails Integer The number of emails with a malformed address or reported as invalid by the receiving server.
Opens Integer The number of times your emails were opened by recipients.
Processed Integer The number of emails pushed to SendGrid.
Requests Integer The number of emails you requested to send via SendGrid.
SpamReportDrops Integer The number of emails automatically dropped because the emails were marked as spam by the recipients.
SpamReports Integer The number of emails marked as spam by recipients.
UniqueClicks Integer The number of unique recipients who clicked links in your emails.
UniqueOpens Integer The number of unique recipients who opened your emails.
UnsubscribeDrops Integer The number of emails in this category dropped by SendGrid because the recipient unsubscribed from your emails.
Unsubscribes Integer The number of recipients who unsubscribed from your emails.



GlobalStats

Query the available Global Stats in SendGrid.

View-Specific Information
Select

You need to specify a time span to select from this table. If you do not specify one, a default span of the past 1 year is used. The Date column supports the >, <, =, <=, and >= operators.

SELECT * FROM GlobalStats 

SELECT * FROM GlobalStats WHERE Date > '2016-01-01' AND Date < '2016-03-30'
Columns

Name Type Description
Date Date The time the global statistic was created.
Blocks Integer The number of emails that were not allowed to be delivered by ISPs.
BounceDrops Integer The number of emails automatically dropped by SendGrid because they appear on one of the suppression lists.
Bounces Integer The number of emails that bounced instead of being delivered.
Clicks Integer The number of links clicked in your emails.
Deferred Integer The number of emails temporarily refused by the receiving server.
Delivered Integer The number of emails confirmed delivered.
InvalidEmails Integer The number of emails with a malformed address or reported as invalid by the receiving server.
Opens Integer The number of times your emails were opened by recipients.
Processed Integer The number of emails pushed to SendGrid.
Requests Integer The number of emails you requested to send via SendGrid.
SpamReportDrops Integer The number of emails automatically dropped because the emails were marked as spam by the recipients.
SpamReports Integer The number of emails marked as spam by recipients.
UniqueClicks Integer The number of unique recipients who clicked links in your emails.
UniqueOpens Integer The number of unique recipients who opened your emails.
UnsubscribeDrops Integer The number of emails globally dropped by SendGrid because the recipient unsubscribed from your emails.
Unsubscribes Integer The number of recipients who unsubscribed from your emails.



GroupSuppressions

Query group suppressions in SendGrid.

Table-Specific Information

Select

GroupSuppressions can only be filtered by GroupId.

SELECT * FROM GroupSuppressions WHERE GroupId = 391



SELECT * FROM GroupSuppressions WHERE GroupId IN (391, 392, 393)
Columns

Name Type Description
GroupId [KEY] Integer Email of the unsubscriber.
Emails String The time the unsubscriber was created.



IPAccessManagement

Query Global Unsubscribes in SendGrid.

View-Specific Information

Select
The driver will use the SendGrid API to retrieve information about the IP addresses which have accessed the account. However there is no filtering supported server-side for this view.

Only the following query is processed server side:

SQL

SELECT * FROM IPAccessManagement
Columns

Name Type Description
IP String IP Address.
Allowed Boolean Indicator if this IP is allowed for access.
AuthMethod String Authentication method.
FirstAt Timestamp First time when IP has accessed the account.
LastAt Timestamp Last time when IP has accessed the account.
Location String Location of the IP.



MessageEvents

List of events related to email message in SendGrid.

View-Specific Information

Select
The driver will use the SendGrid API to process WHERE clause conditions built with the following column and operator. The rest of the filter is executed client side within the driver.

SQL

SELECT * FROM MessageEvents WHERE MessageId = '1234'
Columns

Name Type Description
MessageId String The Id of the message.
EventName String Name of event.

The allowed values are bounced, opened, clicked, processed, dropped, delivered, deferred, spam_report, unsubscribe, group_unsubscribe, group_resubscribe.

Processed Datetime The date when the event was processed.
Reason String Explanation of what caused the message to be 'bounced', 'deferred', or 'blocked'.
AttemptNum Integer Used with 'deferred' events to indicate the attempt number out of 10.
Url String Used with 'clicked' event to indicate which url the user clicked.
BounceType String Use to distinguish between types of bounces.

The allowed values are soft, hard.

HttpUserAgent String Client recipient used to click or open message.
MXServer String The MX server that received the email.
ApiKeyId String Id of the API Key.
AsmGroupId String ASM Group Id.
Categories String Categories users associated to the message.
UniqueArgs String JSON hash of key-value pairs associated with the message.
OriginatingIp String This is the IP address of the person sending the message
OutboundIp String This is the SendGrid dedicated IP address used to send the email
OutboundIpType String The type of the outbound IP.
Teammate String Username of the teammate.
TemplateId String Template ID of the email.



Messages

Query Email Activities in SendGrid.

View-Specific Information

Select
The driver will use the SendGrid API to process WHERE clause conditions built with the following column and operator. The rest of the filter is executed client side within the driver.

Note: The API will return only 1000 records. Please choose from the available filters to restrict the search.

For example, the following queries are processed server side:

SQL

SELECT * FROM Messages WHERE Id = '1234'



SELECT * FROM Messages WHERE Id IN ('1234','4567')



SELECT * FROM Messages WHERE Status = 'not_delivered'



SELECT * FROM Messages WHERE LastEventTime BETWEEN '2020-01-01' AND '2020-01-15'
Columns

Name Type Description
Id [KEY] String The Id of the message.
Status String Status of the email.
Subject String Subject of the email.
FromEmail String The email of the sender.
ToEmail String The email of the receiver.
ClicksCount Integer The number of clicks.
OpensCount Integer The number of times that the email was opened.
LastEventTime Datetime The datetime of the event.
ApiKeyId String Id of the API Key.
AsmGroupId String ASM Group Id.
MarketingCampaignId String The id of the marketing campaign.
MarketingCampaignName String The name of the marketing campaign.
MarketingCampaignSplitId String Split id of the campaign.
MarketingCampaignVersion String Version of the campaign.
OriginatingIp String This is the IP address of the person sending the message
OutboundIp String This is the SendGrid dedicated IP address used to send the email
OutboundIpType String The type of the outbound IP.
Teammate String Username of the teammate.
TemplateId String Template ID of the email.
Events String List of events related to email message in SendGrid.



Recipients

The SendGrid table Recipients.

Table Specific Information

SendGrid has the ability to categorize Recipients with filters defined by the user. Accordingly, you can execute statements to the Recipients table to search by and insert these filters. However, these filters are reported as attributes of the Custom Fields table.

Select

The following query retrieves only the default fields of the Recipients table, not the Custom Fields that you have created. To retrieve the values of the Custom Fields of a Recipient, query the Custom Fields table.

SELECT * FROM Recipients

You can also retrieve all Recipients inside a certain List or a Segment, but it is not possible to filter by both. Use multiple queries instead:

SELECT * FROM Recipients WHERE SegmentId = '1'

SELECT * FROM Recipients WHERE ListId = '2'

You can build criteria depending on a Custom Field. When querying use quotations regardless of type.This kind of filtering is done client side. In this case Age is a CustomField created by the user.

SELECT * FROM Recipients WHERE Age = '30'
Insert

To insert into Recipients Email is required.

You can insert Custom Fields into the Recipients table. See the CustomFields section for more information about how to create custom fields.

INSERT INTO Recipients(Email, FirstName, LastName, Age, Department ... Other Custom Fields as necessary) VALUES('email@domain.com', 'name' ,'surname', '30', 'Education' ... Other Custom Field values)
Update

You can only update from this table by specifying an Id. Additionally, the Email column cannot be updated.

UPDATE Recipients SET Age = '12' WHERE Id = '1'
Delete

You can only delete from this table by specifying an Id.

DELETE FROM Recipients WHERE Id = '1'
Columns

Name Type ReadOnly Description
Id [KEY] String False

This column is dynamic and maps to the corresponding field in the API.

SegmentId Int32 False

This column is dynamic and maps to the corresponding field in the API.

ListId Int32 False

This column is dynamic and maps to the corresponding field in the API.

Email String False

This column is dynamic and maps to the corresponding field in the API.

FirstName String False

This column is dynamic and maps to the corresponding field in the API.

LastName String False

This column is dynamic and maps to the corresponding field in the API.

CreatedAt Datetime True

This column is dynamic and maps to the corresponding field in the API.

LastClicked Datetime True

This column is dynamic and maps to the corresponding field in the API.

LastEmailed Datetime False

This column is dynamic and maps to the corresponding field in the API.

LastOpened Datetime True

This column is dynamic and maps to the corresponding field in the API.

UpdatedAt Datetime True

This column is dynamic and maps to the corresponding field in the API.

Age String False

This column is dynamic and maps to the corresponding field in the API.

Department String False

This column is dynamic and maps to the corresponding field in the API.

University String False

This column is dynamic and maps to the corresponding field in the API.

The SendGrid table Recipients.

Table Specific Information

SendGrid has the ability to categorize Recipients with filters defined by the user. Accordingly, you can execute statements to the Recipients table to search by and insert these filters. However, these filters are reported as attributes of the Custom Fields table.

Select

The following query retrieves only the default fields of the Recipients table, not the Custom Fields that you have created. To retrieve the values of the Custom Fields of a Recipient, query the Custom Fields table.

SELECT * FROM Recipients

You can also retrieve all Recipients inside a certain List or a Segment, but it is not possible to filter by both. Use multiple queries instead:

SELECT * FROM Recipients WHERE SegmentId = '1'

SELECT * FROM Recipients WHERE ListId = '2'

You can build criteria depending on a Custom Field. When querying use quotations regardless of type.This kind of filtering is done client side. In this case Age is a CustomField created by the user.

SELECT * FROM Recipients WHERE Age = '30'
Insert

To insert into Recipients Email is required.

You can insert Custom Fields into the Recipients table. See the CustomFields section for more information about how to create custom fields.

INSERT INTO Recipients(Email, FirstName, LastName, Age, Department ... Other Custom Fields as necessary) VALUES('email@domain.com', 'name' ,'surname', '30', 'Education' ... Other Custom Field values)
Update

You can only update from this table by specifying an Id. Additionally, the Email column cannot be updated.

UPDATE Recipients SET Age = '12' WHERE Id = '1'
Delete

You can only delete from this table by specifying an Id.

DELETE FROM Recipients WHERE Id = '1'
Columns

Name Type Description
Id [KEY] String This column is dynamic and maps to the corresponding field in the API.
AddressLine1 String This column is dynamic and maps to the corresponding field in the API.
AddressLine2 String This column is dynamic and maps to the corresponding field in the API.
City String This column is dynamic and maps to the corresponding field in the API.
Country String This column is dynamic and maps to the corresponding field in the API.
PostalCode String This column is dynamic and maps to the corresponding field in the API.
StateProvinceRegion String This column is dynamic and maps to the corresponding field in the API.
Line String This column is dynamic and maps to the corresponding field in the API.
Facebook String This column is dynamic and maps to the corresponding field in the API.
PhoneNumber String This column is dynamic and maps to the corresponding field in the API.
UniqueName String This column is dynamic and maps to the corresponding field in the API.
WhatsApp String This column is dynamic and maps to the corresponding field in the API.
Email String This column is dynamic and maps to the corresponding field in the API.
FirstName String This column is dynamic and maps to the corresponding field in the API.
LastName String This column is dynamic and maps to the corresponding field in the API.
CreatedAt Datetime This column is dynamic and maps to the corresponding field in the API.
UpdatedAt Datetime This column is dynamic and maps to the corresponding field in the API.

Pseudo-Columns

Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.

Name Type Description
SegmentId String This column is dynamic and maps to the corresponding field in the API.
ListId String This column is dynamic and maps to the corresponding field in the API.



NMCReservedFields

Query the available New Marketing Campaign Reserved Fields in SendGrid.

View-Specific Information

Select

This table does not support filtering. NMC prefix stands for New Marketing Campaign.

SELECT * FROM NMCReservedFields
Columns

Name Type Description
Id String The Id of the reserved field.
Name String The name of the reserved field.
Type String The type of the reserved field.



ReservedFields

Query the available Reserved Fields in SendGrid.

View-Specific Information

Select

This table does not support filtering.

SELECT * FROM ReservedFields
Columns

Name Type Description
Name String The name of the reserved field.
Type String The type of the reserved field.



SubuserStats

Query Subuser Statistics in SendGrid.

View-Specific Information
Select

You can filter by SubuserName to retrieve stats of a specific subuser.

SELECT * FROM SubuserStats WHERE SubuserName = 'Example'

You can also filter by Date. Operators =, >=, <=, <, and > are supported for this column. If you do not specify one, a default span of the past 1 year is used.

SELECT * FROM SubuserStats WHERE SubuserName = 'News' AND Date > '2016-01-01' AND Date < '2016-01-30'
Columns

Name Type Description
Id [KEY] String The Id of the subuser statistic.
SubuserName String The name of the subuser.
Date Datetime The time the subuser statistic was created.
Blocks Integer The number of emails that were not allowed to be delivered by ISPs.
Drops Integer The number of emails automatically dropped because they appear on one of the suppression lists.
Bounces Integer The number of emails that bounced instead of being delivered.
Clicks Integer The number of links that were clicked in the emails from this subuser.
Deferred Integer The number of emails temporarily refused by the receiving server.
Delivered Integer The number of emails from this subsuer that were confirmed delivered.
InvalidEmails Integer The number of emails with a malformed address or reported as invalid by the receiving server.
Opens Integer The number of times emails from this subuser were opened by recipients.
Processed Integer The number of emails pushed to SendGrid by this subuser.
Requests Integer The number of emails that you requested to send via SendGrid from this subuser.
SpamReportDrops Integer The number of emails automatically dropped because the emails were marked as spam by the recipients.
SpamReports Integer The number of emails from this subuser that were marked as spam by recipients.
UniqueClicks Integer The number of unique recipients who clicked on links in your emails from this subuser.
UniqueOpens Integer The number of unique recipients who opened your emails from this subuser.
UnsubscribeDrops Integer The number of emails from this subuser dropped by SendGrid because the recipients unsubscribed from your emails.
Unsubscribes Integer The number of recipients who unsubscribed from your emails from this subuser.
Name String The name of the statistic.
Type String The type of the statistic.



Users

Query the available Users in SendGrid.

View-Specific Information

Select

Users can only be filtered by Id.

SELECT * FROM Users WHERE Id = '1'
Columns

Name Type Description
Id [KEY] String The Id of the user.
Address String The address of the user.
Address2 String The secondary address field for the user.
City String The city of the user.
Company String The company of the user.
Country String The country of the user.
FirstName String The first name of the user.
LastName String The last name of the user.
Phone String The phone number of the user.
State String The state the user is located in.
Website String The Web site URL of the user.
Zip String The ZIP code of the user.