Skip to content

Instantly share code, notes, and snippets.

name: Test
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
bq_op = components.load_component_from_file('./bq_to_csv.yaml')
from kfp import components
components.func_to_container_op(bigquery_to_csv,
output_component_file='bq_to_csv.yaml',
#custom Docker image
base_image='gcr.io/demo-project/custom-container',
#dynamically install packages
packages_to_install=['google-cloud-bigquery-storage','google-cloud-bigquery','pandas','pyarrow'])
#a. importing dependencies
from google.cloud import bigquery
import google.auth
@jy2k
jy2k / function.py
Created May 2, 2021 11:40
Simple Kubeflow component funtion
def bigquery_to_csv(filter_param: str ="50"):
#a. importing dependencies
from google.cloud import bigquery
import google.auth
#b. creating credentials
creds, project = google.auth.default()
client = bigquery.Client(project='demo-project', credentials=creds)
#c. preforming query
@jy2k
jy2k / gist:1057650728013a759063
Created November 23, 2015 23:46
Method get soldier by name
public SoldierDBItem getSoldierByName(String name) throws
SQLException {
QueryBuilder<SoldierDBItem, Integer> qb = getSoldierDao().queryBuilder();
Where where = qb.where();
where.eq(SoldierDBItem.COLUMN_NAME, name);
SoldierDBItem soldierDBItem = qb.queryForFirst();
@jy2k
jy2k / gist:3c89edd058670bac22ff
Created November 23, 2015 22:53
The NOT singleton version of the DatabaseHelper
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils;
import java.sql.SQLException;
@jy2k
jy2k / gist:53efee4a57f1a8c383e5
Last active November 23, 2015 23:12
If you're having a hard time creating the SoldierDBItem look at the following code (Try not to straight out copy)
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
@DatabaseTable(tableName = SoldierDBItem.TABLE_NAME)
public class SoldierDBItem {
public static final String TABLE_NAME = "soldiers";
//
public static final String COLUMN_ID = "id";
@jy2k
jy2k / gist:671fa7bf8a750cff11ac
Last active November 23, 2015 22:41
This is the proper way to parse the response from the JSON
String body = response.body().string();
JSONObject jsonObject = new JSONObject(body);