如何编写与Amazon Redshift连接的DAG?

时间:2018-06-18 13:09:39

标签: airflow

假设我想编写一个DAG来显示Redshift特定模式中的所有表。 1. InputStream.InputStream(); 2. InputStream.methodOne(); 3. InputStream.methodTwo(); 4. InputStream.methodThree(); 查询为 private val bleScanner = object :ScanCallback() { override fun onScanResult(callbackType: Int, result: ScanResult?) { super.onScanResult(callbackType, result) Log.d("DeviceListActivity","onScanResult: ${result?.device?.address} - ${result?.device?.name}") } override fun onBatchScanResults(results: MutableList<ScanResult>?) { super.onBatchScanResults(results) Log.d("DeviceListActivity","onBatchScanResults:${results.toString()}") } override fun onScanFailed(errorCode: Int) { super.onScanFailed(errorCode) Log.d("DeviceListActivity", "onScanFailed: $errorCode") } } private val bluetoothLeScanner: BluetoothLeScanner get() { val bluetoothManager = applicationContext.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager val bluetoothAdapter = bluetoothManager.adapter return bluetoothAdapter.bluetoothLeScanner } class ListDevicesAdapter(context: Context?, resource: Int) : ArrayAdapter<String>(context, resource) override fun onCreate(savedInstanceState: Bundle?) { Log.d("DeviceListActivity", "onCreate()") super.onCreate(savedInstanceState) setContentView(R.layout.activity_device_list) } override fun onStart() { Log.d("DeviceListActivity","onStart()") super.onStart() bluetoothLeScanner.startScan(bleScanner) } override fun onStop() { bluetoothLeScanner.stopScan(bleScanner) super.onStop() }

如何为它创建DAG? 我认为这应该是这样的:

SQL

有谁知道怎么写得正确吗?

1 个答案:

答案 0 :(得分:6)

因为您想要返回该查询的结果而不是仅执行它,您将需要使用PostgresHook,特别是get_records方法。

_id