Skip to content

Instantly share code, notes, and snippets.

@raybuhr
Last active November 8, 2018 21:27
Show Gist options
  • Save raybuhr/1058b847b3d3b553f0d86429a5a7e714 to your computer and use it in GitHub Desktop.
Save raybuhr/1058b847b3d3b553f0d86429a5a7e714 to your computer and use it in GitHub Desktop.

re: dbt-labs/dbt-core#559

New Adapter Information Sheet

The following questions are intended to provide information about a warehouse, for use in building a new dbt adapter. Different data warehouses have pretty different semantics, so some of these questions may be more applicable than others. Where possible, please provide as much detail as you can!

Please copy this questionnaire to a GitHub gist, then fill out answers to the questions to the best of your ability. Where you're done, please post a link to the public gist in the relevant issue. If the issue does not already exist, please create it first.

Questions

  1. What options are there for connecting to the warehouse? Eg: ODBC, a python module, etc

    • PyHive from Dropbox on Github or on PyPI
      • PyHive is a collection of Python DB-API and SQLAlchemy interfaces for Presto and Hive.
    • ... ^ this looks to be the most common and best recommendation across StackOverflow
  2. Is there a consensus around which of the options in #1 is the most featureful/best supported/most mature/etc option?

    • Yes, PyHive
  3. Does the warehouse support namespaces/schemas/datasets (or similar)?

    • Yes, Hive supports create database | schema
  4. Can schemas/namespaces be created using SQL? Eg: create schema my_schema

    • Yes, Hive supports create database | schema
  5. Does the warehouse support logical databases?

    • Yes? Hive supports create database | schema
    • CREATE SCHEMA Partial support as database is used as the equivalent
    • Hive is a collect of files on distributed disk (HDFS), so a database is a logical contruct for organizing those files
  6. Does the warehouse support standard-ish SQL? Are there any noteworthy caveats?

    • Yes, mostly standard with a few cavests
    • These are valid queries
      • SELECT from_columns FROM table WHERE conditions;
      • SELECT DISTINCT column_name FROM table;
      • SELECT owner, COUNT(*) FROM table GROUP BY owner;
      • SELECT pet.name, comment FROM pet JOIN event ON pet.name = event.name;
    • Caveats (from Apache Hive 2.3 supported features)
      • Empty grouping sets not supported
      • PRIMARY KEY constraints are not enforced
      • LIKE enhancements only Partial support Escape characters not supported
      • ARRAY_AGG Partial support, collect_list provides similar functionality
      • Enhanced UNNEST Partial support LATERAL JOIN provides similar functionality
      • Advanced OLAP operations Partial support, PERCENT_RANK, CUME_DIST and ROW_NUMBER supported
  7. Are transactions supported?

    • Partial Transaction support, Autocommit transaction for INSERT/UPDATE/DELETE/MERGE
  8. Can tables be created with create table schema.table as (...)?

    • Yes, CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name
  9. Can views be created with create view schema.view as (...)?

    • Yes, CREATE VIEW [IF NOT EXISTS] view_name
  10. Can tables/views be renamed with alter table {table_name} rename to {new_name}?

  11. Does the warehouse support insert statements? Any caveats?

  12. Does the warehouse support delete statements? Any caveats?

  13. Does the warehouse support update statements? Any caveats?

  14. Does the warehouse support merge statements? Any caveats?

  15. Does the warehouse support drop table/drop view statements? Any caveats?

  16. Does the warehouse support truncate statements? Any caveats?

  17. Does the warehouse support temporary tables? Any caveats?

  18. Can queries be cancelled?

  19. Are views bound to the relations they select from? Ie. do drop table statements require a ...cascade argument?

  20. Does the warehouse support querying for existing relations (ie. their existence and type)? Is this via an API call or a SELECT statement? Eg: select * from information_schema.tables.

  21. Does the warehouse support querying for the the columns in a relation? Is this via an API call or a SELECT statement? Eg: select * from information_schema.columns

  22. Can columns be added and removed using DDL? Eg: alter table add column ?

  23. Does the warehouse support non-standard performance configurations? Ie. clustering, partitioning, sort/dist keys, etc. What are they, and how are they used? Can they be supplied in create table as statements?

  24. Which column types does the warehouse support? Are text types varchars (with sizes) or unsized string columns? Are numeric types (with fixed precision) supported? Is there a different type for timestamps with timezones? Any caveats?

  25. Does the warehouse support column-level constraints (eg. unique, not null, foreign key, primary key)? Are they enforced? Can they be defined in create table as statements?

  26. Are there other noteworthy quirks/features of the warehouse that have not been specified above? If so: please enumerate them here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment