Skip to content

Commit

Permalink
add dbt.current_timestamp() (#4741)
Browse files Browse the repository at this point in the history
this pr adds `dbt.current_timestamp()` macro to the cross database macro
page.

Resolves #3370
  • Loading branch information
mirnawong1 authored Jan 18, 2024
2 parents 51518a3 + be5c018 commit fe82b6d
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Please make sure to take a look at the [SQL expressions section](#sql-expression
- [type\_numeric](#type_numeric)
- [type\_string](#type_string)
- [type\_timestamp](#type_timestamp)
- [current\_timestamp](#current_timestamp)
- [Set functions](#set-functions)
- [except](#except)
- [intersect](#intersect)
Expand Down Expand Up @@ -76,6 +77,7 @@ Please make sure to take a look at the [SQL expressions section](#sql-expression
- [type\_numeric](#type_numeric)
- [type\_string](#type_string)
- [type\_timestamp](#type_timestamp)
- [current\_timestamp](#current_timestamp)
- [Set functions](#set-functions)
- [except](#except)
- [intersect](#intersect)
Expand Down Expand Up @@ -316,6 +318,29 @@ This macro yields the database-specific data type for a `TIMESTAMP` (which may o
TIMESTAMP
```

### current_timestamp

This macro returns the current date and time for the system. Depending on the adapter:

- The result may be an aware or naive timestamp.
- The result may correspond to the start of the statement or the start of the transaction.


**Args**
- None

**Usage**
- You can use the `current_timestamp()` macro within your dbt SQL files like this:

```sql
{{ dbt.current_timestamp() }}
```
**Sample output (PostgreSQL)**

```sql
now()
```

## Set functions

### except
Expand Down

0 comments on commit fe82b6d

Please sign in to comment.