Skip to content

Instantly share code, notes, and snippets.

View kevpie's full-sized avatar

Kevin Pierce kevpie

View GitHub Profile
@kevpie
kevpie / duckdb_bq_storage_api.py
Created September 27, 2024 06:42 — forked from ML-engineer/duckdb_bq_storage_api.py
Read BQ table to DuckDB directly from storage read api
import duckdb
from google.cloud import bigquery
bqclient = bigquery.Client()
table = bigquery.TableReference.from_string(
"bigquery-public-data.utility_us.country_code_iso"
)
rows = bqclient.list_rows(table)
country_code_iso = rows.to_arrow(create_bqstorage_client=True)
cursor = duckdb.connect()
@kevpie
kevpie / run.sh
Last active August 29, 2015 14:22
How do I get SaltStack to skip managing file for log.sh if it doesn't exist?
#!/bin/sh
exec 2>&1
exec /opt/runit_enabled/bin/runnable.sh
{
"window": {
"id": 2717,
"challenge_id": 95,
"start_date": "2014-01-13 00:00:00",
"end_date": "2014-01-19 23:59:59",
"interval": "1 day",
"ruleset": {
"id": 1, "multipliers": {"device-steps": 1}, "rules": [
{
@kevpie
kevpie / domain.py
Created April 27, 2011 16:25
Simple Model to Domain object creation
def update_object(model, obj):
for name, property in model.properties().iteritems():
setattr(obj, name, property.get_value_for_datastore(model))
def to_object(model):
def __eq__(self, other):
return self.__dict__ == other.__dict__
def __cmp__(self, other):
return cmp(self.__dict__, other.__dict__)
DomainType = type(model.kind(), (object,), dict(__eq__=__eq__, __cmp__=__cmp__))