cancel
Showing results for 
Search instead for 
Did you mean: 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results for 
Search instead for 
Did you mean: 

Databricks SQL connector for python

NS2
New Contributor II

For Databricks SQL connector for python, the list of fields returned by Cursor.columns() is listed in here (like TABLE_CAT,  TABLE_SCHEMTABLE_NAME,  COLUMN_NAME). Could someone please share an exhaustive list of fields (including short description of fields if posssible) returned by cursor.columns()? I couldn't find any documentation related to this.
I'm interested in field - DATA_TYPE, wanted to confirm if this is same as java SQL types (link). Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Alberto_Umana
Databricks Employee
Databricks Employee

Hello @NS2,

List of fields returned by Cursor.columns() in Databricks SQL Connector for Python: https://docs.databricks.com/en/dev-tools/python-sql-connector.html#cursor-class&language-Cluster

  • TABLE_CAT: The name of the catalog.
  • TABLE_SCHEM: The name of the schema.
  • TABLE_NAME: The name of the table.
  • COLUMN_NAME: The name of the column.
  • DATA_TYPE: The SQL data type of the column. This corresponds to Java SQL types
  • TYPE_NAME: The data source-dependent type name.
  • COLUMN_SIZE: The column size.
  • BUFFER_LENGTH: The buffer length.
  • DECIMAL_DIGITS: The number of decimal digits.
  • NUM_PREC_RADIX: The radix (typically either 10 or 2).
  • NULLABLE: Whether the column allows NULL values.
  • REMARKS: A description of the column.
  • COLUMN_DEF: The default value of the column.
  • SQL_DATA_TYPE: The SQL data type.
  • SQL_DATETIME_SUB: The SQL datetime subcode.
  • CHAR_OCTET_LENGTH: The maximum number of bytes in the column.
  • ORDINAL_POSITION: The index of the column in the table (starting at 1).
  • IS_NULLABLE: Whether the column allows NULL values (YES/NO).
  • SCOPE_CATALOG: The catalog of the table that is the scope of a reference attribute.
  • SCOPE_SCHEMA: The schema of the table that is the scope of a reference attribute.
  • SCOPE_TABLE: The table name that is the scope of a reference attribute.
  • SOURCE_DATA_TYPE: The source type of a distinct type or user-generated Ref type.
  • IS_AUTOINCREMENT: Whether the column is auto-incremented (YES/NO).
  • IS_GENERATEDCOLUMN: Whether the column is a generated column (YES/NO).

View solution in original post

3 REPLIES 3

Alberto_Umana
Databricks Employee
Databricks Employee

Hello @NS2,

List of fields returned by Cursor.columns() in Databricks SQL Connector for Python: https://docs.databricks.com/en/dev-tools/python-sql-connector.html#cursor-class&language-Cluster

  • TABLE_CAT: The name of the catalog.
  • TABLE_SCHEM: The name of the schema.
  • TABLE_NAME: The name of the table.
  • COLUMN_NAME: The name of the column.
  • DATA_TYPE: The SQL data type of the column. This corresponds to Java SQL types
  • TYPE_NAME: The data source-dependent type name.
  • COLUMN_SIZE: The column size.
  • BUFFER_LENGTH: The buffer length.
  • DECIMAL_DIGITS: The number of decimal digits.
  • NUM_PREC_RADIX: The radix (typically either 10 or 2).
  • NULLABLE: Whether the column allows NULL values.
  • REMARKS: A description of the column.
  • COLUMN_DEF: The default value of the column.
  • SQL_DATA_TYPE: The SQL data type.
  • SQL_DATETIME_SUB: The SQL datetime subcode.
  • CHAR_OCTET_LENGTH: The maximum number of bytes in the column.
  • ORDINAL_POSITION: The index of the column in the table (starting at 1).
  • IS_NULLABLE: Whether the column allows NULL values (YES/NO).
  • SCOPE_CATALOG: The catalog of the table that is the scope of a reference attribute.
  • SCOPE_SCHEMA: The schema of the table that is the scope of a reference attribute.
  • SCOPE_TABLE: The table name that is the scope of a reference attribute.
  • SOURCE_DATA_TYPE: The source type of a distinct type or user-generated Ref type.
  • IS_AUTOINCREMENT: Whether the column is auto-incremented (YES/NO).
  • IS_GENERATEDCOLUMN: Whether the column is a generated column (YES/NO).

NS2
New Contributor II

 

I'm unable to view this in the link that you shared. Do we need any additional permissions for it? This is helpful, thank you! 🙂

Satyadeepak
Databricks Employee
Databricks Employee

All those fields are explained in the doc. For example search with `TABLE_CAT`

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group