ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

tf.data.experimental.SqlDataset

A Dataset consisting of the results from a SQL query.

Inherits From: Dataset

SqlDataset allows a user to read data from the result set of a SQL query. For example:

dataset = tf.data.experimental.SqlDataset("sqlite", "/foo/bar.sqlite3",
                                          "SELECT name, age FROM people",
                                          (tf.string, tf.int32))
# Prints the rows of the result set of the above query.
for element in dataset:
  print(element)

driver_name A 0-D tf.string tensor containing the database type. Currently, the only supported value is 'sqlite'.
data_source_name A 0-D tf.string tensor containing a connection string to connect to the database.
query A 0-D tf.string tensor containing the SQL query to execute.
output_types A tuple of tf.DType objects representing the types of the columns returned by query.

element_spec The type specification of an element of this dataset.