On Morph, data can be retrieved by writing SQL against the connected database.

On SQL, by utilising the config function and specifying a connection, you can easily issue SQL against the database connected with Connections.

{{
	config(
		name="test",
		description="this is test sql statement",
		connection="your_connection_slug"
	)
}}

select 1 as test
Although it is common practice in SQL to add a semicolon at the end of a statement, the use of semicolons is prohibited to prevent multiple SQL being written in a single file.

Jinja

SQL files on Morph can be written flexibly with Jinja, which allows conditional branches such as placeholder and if statements to be written in the SQL.

Link: https://jinja.palletsprojects.com/en/2.10.x/templates/#synopsis

Functions are also available to make data analysis easier by utilising Jinja. See config and functions such as load_data for more information on this.