Skip to content

Instantly share code, notes, and snippets.

@zacgx
zacgx / agent.py
Created February 23, 2023 08:55 — forked from wiseman/agent.py
Langchain example: self-debugging
from io import StringIO
import sys
from typing import Dict, Optional
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents.tools import Tool
from langchain.llms import OpenAI
@zacgx
zacgx / task-dag-creation.py
Created December 5, 2017 00:34 — forked from tmarthal/task-dag-creation.py
DAG Creation from within a PythonOperator task DOES NOT WORK
# -*- coding: utf-8 -*-
from airflow.operators.http_operator import SimpleHttpOperator
from airflow.operators.postgres_operator import PostgresOperator
from airflow.operators.subdag_operator import SubDagOperator
from airflow.operators.sensors import SqlSensor
from airflow.hooks.postgres_hook import PostgresHook
from airflow.operators.python_operator import PythonOperator
from airflow.models import Variable, DAG
@zacgx
zacgx / task-dag-creation.py
Created December 5, 2017 00:34 — forked from tmarthal/task-dag-creation.py
DAG Creation from within a PythonOperator task DOES NOT WORK
# -*- coding: utf-8 -*-
from airflow.operators.http_operator import SimpleHttpOperator
from airflow.operators.postgres_operator import PostgresOperator
from airflow.operators.subdag_operator import SubDagOperator
from airflow.operators.sensors import SqlSensor
from airflow.hooks.postgres_hook import PostgresHook
from airflow.operators.python_operator import PythonOperator
from airflow.models import Variable, DAG
@zacgx
zacgx / to_redshift.py
Created April 5, 2017 18:12 — forked from josepablog/to_redshift.py
to_redshift.py
import gzip
from functools import wraps
import boto3
from sqlalchemy import MetaData
from pandas import DataFrame
from pandas.io.sql import SQLTable, pandasSQL_builder
import psycopg2
import codecs
import cStringIO
from io import BytesIO