Packages

  • package root
    Definition Classes
    root
  • package edu
    Definition Classes
    root
  • package chop
    Definition Classes
    edu
  • package cbmi
    Definition Classes
    chop
  • package dataExpress
    Definition Classes
    cbmi
  • package backends

    Provides database wrappers and connectivity for MySQL, Postgres, Oracle, and SQLite JDBC drivers.

    Provides database wrappers and connectivity for MySQL, Postgres, Oracle, and SQLite JDBC drivers.

    Overview

    The support for individual databases is broken out into several classes:

    The SqlBackend for the corresponding database is the primary means of establishing a datsbase connection when using DataExpress. However, It is important to note that it is generally easier, and safer to use the edu.chop.cbmi.dataExpress.backends.SqlBackendFactory to establish the necessary backend and set up the connection

    In general the SQLDialect and BackendProvider are used as part of a SQLBackend, and not directly.

    Usage

    The edu.chop.cbmi.dataExpress.backends.SqlBackend requires properties to fully configure itself. Typically these are loaded from a file, but can also be supplied through a standard java.util.Properties object. The SQL backend has very simple requirements for properties files. They must contain the following keys:

    • driverClassName: The class name for the actual database driver
    • jdbcUri: This is the URI required by the database driver. It is passed through directly to JDBC so you are free to specify schemas and other information here
    • username: The username to authenticate against the database (not required for non-authenticated RDBMS systems such as SQLite) -password: The password for accessing the database

    DataExpress will pass along any other properties it finds directly to JDBC, so in cases where a database requires specific connection configuration (e.g. to enable SSL for Postgres), those settings can be passed along.

    In some cases, DataExpress will set specific properties on the connection to ensure predictable behavior. Most of these have been empirically determined by our testing given the narrow use cases for DataExpress. Where possible, we have made it possible for you to override these defaults in your own configuration file, however this is generally not recommended.

    Definition Classes
    dataExpress
    Example:
    1. scala> import edu.chop.cbmi.dataExpress.backends._
      import edu.chop.cbmi.dataExpress.backends._
      
      scala> val backend = SqlBackendFactory "src/test/resources/sqlite_test.properties"
      backend: edu.chop.cbmi.dataExpress.backends.SqlBackend = SqlBackend({jdbcUri=jdbc:sqlite:target/source.sqlite},SqLiteDialect,org.sqlite.JDBC)
      
      scala> backend connect
      res0: java.sql.Connection = org.sqlite.Conn@7168f171
      
      scala> backend execute """CREATE TABLE de_test(id INTEGER, first_name VARCHAR, last_name VARCHAR)"""
      res1: Boolean = false
      
      scala> backend commit
      res3: Boolean = false
      
      scala> backend executeQuery "select count(*) from de_test"
      res4: java.sql.ResultSet = org.sqlite.RS@3b070e76
      
      scala> res4.getInt(1)
      res5: Int = 0
    Note

    The SQL backends return jdbc ResultSets which are typically a little more "low-level" than what you would probably want for ETL purporses. The edu.chop.cbmi.dataExpress.dataModels.sql.SqlRelation is a much more convenient object to use for ETL.

  • package file
    Definition Classes
    backends
  • GenericSqlDialect
  • MySqlBackend
  • MySqlDialect
  • OracleBackend
  • OracleServiceProvider
  • OracleSqlDialect
  • PostgresBackend
  • PostgresSqlDialect
  • SqLiteBackend
  • SqLiteDialect
  • SqlBackend
  • SqlBackendFactory
  • SqlBackendProvider
  • SqlDialect
  • SqlQueryCache
  • SqlServerBackend
  • SqlServerServiceProvider
  • SqlServerSqlDialect
o

edu.chop.cbmi.dataExpress.backends

PostgresSqlDialect

object PostgresSqlDialect extends SqlDialect with Product with Serializable

SQL dialect for Postgres

See also

edu.chop.cbmi.dataExpress.backends.SqlDialect

Linear Supertypes
Serializable, Serializable, Product, Equals, SqlDialect, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PostgresSqlDialect
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. SqlDialect
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. def commit(): String

    Returns a COMMIT SQL Statement

    Returns a COMMIT SQL Statement

    Definition Classes
    PostgresSqlDialectSqlDialect
  7. def createTable(name: String, columns: List[(String, DataType)], schemaName: Option[String]): String

    Returns a complete CREATE TABLE SQL statement

    Returns a complete CREATE TABLE SQL statement

    name

    the table name

    columns

    a list of column tuples where each tuple is a column name and edu.chop.dataExpress.dataModels.sql.DataType

    schemaName

    the schema where the table will be created

    Definition Classes
    PostgresSqlDialectSqlDialect
  8. def dropTable(name: String, cascade: Boolean = false, schemaName: Option[String] = None): String

    Returns a complete DROP TABLE SQL Statement

    Returns a complete DROP TABLE SQL Statement

    name

    The name of the table

    cascade

    Indicates whether the cascade option should be used (by default it is not)

    schemaName

    The schema where the table should be dropped

    Definition Classes
    PostgresSqlDialectSqlDialect
  9. def endTransaction(): String

    Returns an end SQL transaction statement

    Returns an end SQL transaction statement

    Definition Classes
    PostgresSqlDialectSqlDialect
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. val identifierQuote: String
  15. def insertRecord(tableName: String, columnNames: List[String], schemaName: Option[String] = None): String

    Returns an INSERT statement (where the values to be inserted are placeholder variables to be assigned during JDBC prepared statement construction

    Returns an INSERT statement (where the values to be inserted are placeholder variables to be assigned during JDBC prepared statement construction

    tableName

    The name of the table where the insert will be applied

    columnNames

    A list of the column names to use when performing the insert

    schemaName

    The schema where the table is located

    Definition Classes
    PostgresSqlDialectSqlDialect
  16. val insertStatement: String
  17. val insertValues: String
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def mapDataTypes(column_names: Seq[String], meta: ResultSetMetaData): Seq[Product with Serializable with DataType]

    Returns the DataExpress edu.chop.cbmi.dataExpress.dataModels.DataType values for columns in a JDBC ResultSet

    Returns the DataExpress edu.chop.cbmi.dataExpress.dataModels.DataType values for columns in a JDBC ResultSet

    column_names

    A sequence of column names

    meta

    JDBC ResultSet metadata

    Definition Classes
    SqlDialect
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. def quoteIdentifier(id: String): String

    Returns a database identifier (such as a table or column name) using the proper quote format.

    Returns a database identifier (such as a table or column name) using the proper quote format. Note that in some databases it is considered an error to quote non-system strings, so this method should carefully implement this logic if necessary.

    id

    The identifier that must be returned quoted

    Definition Classes
    PostgresSqlDialectSqlDialect
  24. def rollback(): String

    Returns a ROLLBACK SQL statement

    Returns a ROLLBACK SQL statement

    Definition Classes
    PostgresSqlDialectSqlDialect
  25. def startTransaction(): String

    Returns a start SQL transaction statement

    Returns a start SQL transaction statement

    Definition Classes
    PostgresSqlDialectSqlDialect
  26. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  27. val tableCascade: String
  28. val tableCreate: String
  29. val tableDrop: String
  30. val tableTruncate: String
  31. def toSqlString(dataType: DataType): String

    Returns the database-appropriate SQL type representation of a edu.chop.cbmi.dataExpress.dataModels.DataType

    Returns the database-appropriate SQL type representation of a edu.chop.cbmi.dataExpress.dataModels.DataType

    Definition Classes
    PostgresSqlDialectSqlDialect
  32. val transactionCommit: String
  33. val transactionEnd: String
  34. val transactionRollback: String
  35. val transactionStart: String
  36. def truncate(table: String, schemaName: Option[String] = None): String

    Returns a complete TRUNCATE TABLE SQL Statement

    Returns a complete TRUNCATE TABLE SQL Statement

    table

    The name of the table to truncate

    schemaName

    The schema where the table should be truncated

    Definition Classes
    PostgresSqlDialectSqlDialect
  37. def updateRecords(tableName: String, columnNames: List[String], filter: List[(String, Any)], schemaName: Option[String] = None): String

    Returns a SQL UPDATE statement that using a filter on table values.

    Returns a SQL UPDATE statement that using a filter on table values. In order to allow specificity, the user passes in a list of (columnName, value) filters. The expected behavior is that these tuples get converted into the WHERE clause. For example:

    List(("id",12345),("type","Luggage Combination"))

    passed in as a filter is converted to the SQL WHERE id = 12345 AND type = 'Luggage Combination'

    tableName

    The name of the table where the update will be applied

    columnNames

    The list of column names to be updated

    filter

    A list of (columnName,value) tuples to be used when constructing the WHERE clause

    Definition Classes
    PostgresSqlDialectSqlDialect
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from SqlDialect

Inherited from AnyRef

Inherited from Any

Ungrouped