Skip to content

Commit

Permalink
Document the is_integer method
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 authored Sep 22, 2023
1 parent 46f0373 commit c51321f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions website/docs/reference/dbt-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ col = Column('name', 'varchar', 255)
col.is_string() # True
col.is_numeric() # False
col.is_number() # False
col.is_integer() # False
col.is_float() # False
col.string_type() # character varying(255)
col.numeric_type('numeric', 12, 4) # numeric(12,4)
Expand All @@ -112,6 +113,7 @@ col.numeric_type('numeric', 12, 4) # numeric(12,4)
- **is_string()**: Returns True if the column is a String type (eg. text, varchar), else False
- **is_numeric()**: Returns True if the column is a fixed-precision Numeric type (eg. `numeric`), else False
- **is_number()**: Returns True if the column is a number-y type (eg. `numeric`, `int`, `float`, or similar), else False
- **is_integer()**: Returns True if the column is an integer (eg. `int`, `bigint`, `serial` or similar), else False
- **is_float()**: Returns True if the column is a float type (eg. `float`, `float64`, or similar), else False
- **string_size()**: Returns the width of the column if it is a string type, else, an exception is raised

Expand All @@ -136,6 +138,9 @@ col.numeric_type('numeric', 12, 4) # numeric(12,4)
-- Return true if the column is a number
{{ string_column.is_number() }}
-- Return true if the column is an integer
{{ string_column.is_integer() }}
-- Return true if the column is a float
{{ string_column.is_float() }}
Expand All @@ -151,6 +156,9 @@ col.numeric_type('numeric', 12, 4) # numeric(12,4)
-- Return true if the column is a number
{{ numeric_column.is_number() }}
-- Return true if the column is an integer
{{ numeric_column.is_integer() }}
-- Return true if the column is a float
{{ numeric_column.is_float() }}
Expand Down

0 comments on commit c51321f

Please sign in to comment.