diff --git a/.gitignore b/.gitignore index dcc9a90..f519ef1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ apikeys.ps1 stackql stackql-zip test.py -*.json \ No newline at end of file +*.json +stackql-aws-cloud-shell.sh +stackql-azure-cloud-shell.sh +stackql-google-cloud-shell.sh \ No newline at end of file diff --git a/README.md b/README.md index e09417e..8b224d5 100644 --- a/README.md +++ b/README.md @@ -154,4 +154,4 @@ docker compose down To remove the image locally run: ```bash docker rmi stackql-jupyter-demo-jupyter:latest -``` \ No newline at end of file +``` diff --git a/notebooks/github/github.ipynb b/notebooks/github/github.ipynb index ff9270f..9857672 100644 --- a/notebooks/github/github.ipynb +++ b/notebooks/github/github.ipynb @@ -58,7 +58,57 @@ "metadata": {}, "outputs": [], "source": [ - "# get commits by author" + "since = '2022-07-01T00:00:00Z'\n", + "until = '2023-06-30T23:59:59Z' " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%stackql\n", + "SELECT SUBSTR(DATE(JSON_EXTRACT(commit, '$$.author.date')),1,7) AS commit_month, count(*) AS num_commits\n", + "FROM github.repos.commits \n", + "WHERE since = '$since' and until = '$until'\n", + "and owner = '$owner' AND repo = 'stackql'\n", + "GROUP BY commit_month" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "pd.set_option('display.max_colwidth', None)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%stackql\n", + "SELECT \n", + "DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+11 hours') as commit_date,\n", + "CASE strftime('%w', DATETIME(JSON_EXTRACT(commit, '$$.author.date'), '+11 hours'))\n", + "WHEN '0' THEN 'Sunday'\n", + "WHEN '1' THEN 'Monday'\n", + "WHEN '2' THEN 'Tuesday'\n", + "WHEN '3' THEN 'Wednesday'\n", + "WHEN '4' THEN 'Thursday'\n", + "WHEN '5' THEN 'Friday'\n", + "WHEN '6' THEN 'Saturday'\n", + "END AS day_of_week,\n", + "JSON_EXTRACT(commit, '$$.message') as commit_message\n", + "FROM github.repos.commits \n", + "WHERE since = '2023-01-01T00:00:00Z' and until = '2023-01-31T23:59:59Z'\n", + "and owner = '$owner' AND repo = 'stackql'\n", + "ORDER BY commit_date ASC" ] } ],