<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sasakky on Medium]]></title>
        <description><![CDATA[Stories by Sasakky on Medium]]></description>
        <link>https://medium.com/@Sasakky?source=rss-1a88acf2ef9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sC0n0ljdddI0j7Mfv73nUA.jpeg</url>
            <title>Stories by Sasakky on Medium</title>
            <link>https://medium.com/@Sasakky?source=rss-1a88acf2ef9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 20:03:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Sasakky/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Launch multiple Airflow processes in Docker]]></title>
            <link>https://medium.com/@Sasakky/launch-multiple-airflow-processes-in-docker-ab915e3b9b68?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab915e3b9b68</guid>
            <category><![CDATA[airflow]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[supervisord]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Sun, 08 May 2022 13:22:58 GMT</pubDate>
            <atom:updated>2022-05-08T13:22:58.118Z</atom:updated>
            <content:encoded><![CDATA[<h3>What’s this</h3><p>When we were building the Airflow development environment with Docker, it was time-consuming to go into the container and start webserver and scheduler every time we rebuilt the container, so we considered whether Airflow could be started when the container was launched.</p><h3><strong>TL;DR</strong></h3><p>I looked at the <a href="https://docs.docker.com/config/containers/multi-service_container/">official Docker documentation</a> and used Supervisord.</p><h3>What’s supervisord</h3><p>Process monitoring tool. It monitors processes on behalf of the user and restarts them.<br>See<a href="http://supervisord.org/"> the official documentation</a> for a brief description of how to use the tool.</p><h3>Config</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb0eeca19f2a002db5a9c182dc6963f6/href">https://medium.com/media/cb0eeca19f2a002db5a9c182dc6963f6/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0974b1f93544b8a1f09f49f634a75663/href">https://medium.com/media/0974b1f93544b8a1f09f49f634a75663/href</a></iframe><p>[supervisord] is a global setting.<br>nodeamon: Whether to run as a foreground process.<br>user: Which user authority should be used to run the process.</p><p>[program] is a setting for each process.<br>command: Command to execute<br>autorestart: Automatic restart ON/OFF<br>stopsignal: Signal to be issued when exiting<br>stopasgroup: Whether to terminate the entire process<br>killasgroup：Terminate all child processes together</p><p>The configuration file is located in /etc/supervisor/supervisord.conf, but place /etc/supervisor/conf.d/airflow.conf since the configuration file is included as follows.</p><pre>[include]<br>files = /etc/supervisor/conf.d/*.conf</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab915e3b9b68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Execute Cloud Build and Cloud Run with Github Actions]]></title>
            <link>https://medium.com/@Sasakky/execute-cloud-build-and-cloud-run-with-github-actions-83c4680b677e?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/83c4680b677e</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[google-cloud-build]]></category>
            <category><![CDATA[google-cloud-run]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Sun, 08 May 2022 02:16:16 GMT</pubDate>
            <atom:updated>2022-05-08T02:16:16.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*bH85PhPxRl9dBs4bI70cqQ.png" /></figure><h3>What’s this</h3><p>The data pipeline created in <a href="https://medium.com/@Sasakky/building-a-robust-data-pipeline-with-great-expectations-dbt-and-airflow-d12b8bba030">Building a Robust Data Pipeline with Great Expectations, dbt and airflow</a> can be deployed to GCP automatically using Github Actions, so I summarized the research and code at that time.</p><h3>Assumption</h3><p>Normally, if you want to deploy Airflow, you would use Cloud Composer or deploy with GKE, but since the servers are resident and costly, and since this is just for my own practice, I will dare to deploy it all in one container.</p><h3>Requirement</h3><ul><li>Triggered by a push to the main branch, Github Actions automatically deploys the container on GCP.</li><li>Once deployed, tasks are scheduled by Airflow to perform periodic data validation and loading.</li><li>Containers are deployed using CloudBuild and CloudRun by reading the Dockerfile in the repository.</li><li>Service account keys required for deployment and for Airflow to handle resources in GCP are stored and passed in GithubActions secrets.</li></ul><h3>Directory Structure</h3><pre>.<br>├── prod # files for deploy<br>│   ├── Dockerfile.prod<br>│   ├── airflow.conf<br>│   └── cloudbuild.yaml<br>└── scr # source code<br>    ├── dag<br>    ├── dbt<br>    └── great_expectations</pre><h3>Develop</h3><p>Add following code in dockerfile.prod</p><pre>ARG GCP_AIRFLOW_SA_KEY<br>RUN echo -n ${GCP_AIRFLOW_SA_KEY} | base64 --decode &gt; /tmp/gcp_secret.json</pre><p>cloudbuild.yaml:</p><pre>steps:<br>- name: &#39;gcr.io/cloud-builders/docker&#39;<br>  args: [&#39;build&#39;, &#39;-t&#39;, &#39;gcr.io/***/prod_data_pipeline&#39;, &#39;--build-arg&#39;, &#39;GCP_AIRFLOW_SA_KEY=${_GCP_AIRFLOW_SA_KEY}&#39;, &#39;-f&#39;, &#39;./prod/Dockerfile.prod&#39;, &#39;.&#39;]<br>substitutions:<br>  _GCP_AIRFLOW_SA_KEY: foobar<br>options:<br>    substitution_option: &#39;ALLOW_LOOSE&#39;</pre><p>ci.yaml:</p><pre>on:<br>  push:<br>    branches:<br>      - main</pre><pre>name: Build and Deploy a Container<br>env:<br>  PROJECT_ID: ${{ secrets.GCP_PROJECT }}<br>  GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}<br>  GCP_AIRFLOW_SA_KEY: ${{ secrets.GCP_AIRFLOW_SA_KEY }}<br>  SERVICE: datapipeline<br>  REGION: us-central1<br>  IMAGE: gcr.io/${{ secrets.GCP_PROJECT }}/prod_data_pipeline<br>  PORT: 8080<br>  MEMORY: 2G</pre><pre>jobs:<br>  deploy:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout<br>        uses: actions/checkout@v2</pre><pre>- name: Setup Cloud SDK<br>        uses: google-github-actions/setup-gcloud@v0.2.0<br>        with:<br>          project_id: ${{ env.PROJECT_ID }}<br>          service_account_key: ${{ secrets.GCP_SA_KEY }}<br>          export_default_credentials: true <br>      <br>      - name: Configure Docker<br>        run: |<br>          gcloud auth configure-docker</pre><pre>- name: Deploy to Cloud Build<br>        run: |<br>          gcloud builds submit --config ./prod/cloudbuild.yaml --substitutions=_GCP_AIRFLOW_SA_KEY=${{ env.GCP_AIRFLOW_SA_KEY }}</pre><pre>- name: Deploy to Cloud Run<br>        run: |<br>          gcloud run deploy ${{ env.SERVICE }} --project ${{ env.PROJECT_ID }} --region ${{ env.REGION }} --image ${{ env.IMAGE }} --port ${{ env.PORT }} --memory ${{ env.MEMORY }}</pre><p>As a complicated configuration, it is necessary to specify the Key Json Path in the connection of Airflow, and I was not sure how to pass the contents of the key JSON registered in the secrets of Github Actions to the Dockerfile, so I followed the flow as follows.<br>(1) Register the encoded string in the secrets<br>(2) Inject ① as substitutions when executing cloudbuild.yaml in ci.yaml.<br>(3) Pass as — build-arg to dockerfile in cloudbuild.yaml<br>(4) Decode the received arg in dockerfile to create and deploy a json file</p><h3>Execution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iezL1Yqx5sMBXGmr.png" /></figure><p>The deploy was successful. One of the factors that got me stuck in the middle is that if IAM for the gcloud service account is not properly set up, as described in the article <a href="https://towardsdatascience.com/deploy-to-google-cloud-run-using-github-actions-590ecf957af0">here</a>, the build will fail on Github Actions even if the build succeeds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GYJ4XeCgFEcNNfx2.png" /></figure><p>I checked the behavior of Airflow with CloudRun and the webserver started up successfully and successfully ran the job.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83c4680b677e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building A Robust Data Pipeline With Great Expectations, dbt and Airflow]]></title>
            <link>https://medium.com/@Sasakky/building-a-robust-data-pipeline-with-great-expectations-dbt-and-airflow-d12b8bba030?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d12b8bba030</guid>
            <category><![CDATA[great-expectations]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[data-management]]></category>
            <category><![CDATA[airflow]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Sat, 07 May 2022 04:38:46 GMT</pubDate>
            <atom:updated>2022-05-07T04:38:46.748Z</atom:updated>
            <content:encoded><![CDATA[<h3>What’s this</h3><p>Watch the video of the 2020 dbt-related session called <a href="https://www.youtube.com/watch?v=9iN6iw7Lamo">Building a robust data pipeline with dbt, Airflow, and Great Expectations</a>, and build a data model while testing with Great Expectations and dbt. I was curious about the idea of building a robust data pipeline by running the pipeline with Airflow, so I actually built one myself and ran it.</p><h3>System Flow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/0*oq5YC9f45T69JHPf.png" /></figure><p>The data pipeline is outlined below.<br>1) Validation checks are applied to BigQuery tables in Great Expectations. The validation results are uploaded to GCS for viewing.<br>(2) If the validation is successful, transform the data by dbt.<br>If the transformation is successful, execute the test.<br>(4) Run steps (1) to (3) in Airflow.</p><h3>Preparation</h3><p>The Great Expectations and BigQuery surroundings are basically adapted from <a href="https://medium.com/@Sasakky/how-to-use-great-expectations-with-bigquery-54aad4aa2dd">the previous article</a>.</p><p>Dockerfile:</p><pre>FROM python:3.9-slim</pre><pre>RUN apt-get update -y &amp;&amp; \<br>    apt-get install --no-install-recommends -y -q \<br>    git libpq-dev python3-dev build-essential &amp;&amp; \ <br>    apt-get clean &amp;&amp; \<br>    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*</pre><pre>RUN pip install --upgrade pip &amp;&amp; \<br>    pip install great_expectations &amp;&amp; \<br>    pip install sqlalchemy==1.4.25 &amp;&amp; \<br>    pip install sqlalchemy_bigquery &amp;&amp; \<br>    pip install pybigquery &amp;&amp; \<br>    pip install dbt-bigquery &amp;&amp; \<br>    pip install apache-airflow[gcp] &amp;&amp; \<br>    pip install airflow-dbt</pre><pre>RUN curl -sSL <a href="https://sdk.cloud.google.com/">https://sdk.cloud.google.com</a> | bash</pre><pre>ENV PATH $PATH:/root/google-cloud-sdk/bin</pre><pre>ENV PYTHONIOENCODING=utf-8<br>ENV LANG C.UTF-8</pre><p>docker-compose.yml:</p><pre>version: &#39;3.9&#39;</pre><pre>services:<br>  great_expectations:<br>    container_name: great_expectations<br>    build: .<br>    ports:<br>      - &quot;8888:8888&quot;<br>      - &quot;8080:8080&quot;<br>      - &quot;8081:8081&quot;<br>    tty: true<br>    working_dir: /usr/app<br>    environment:<br>      - DBT_PROFILES_DIR=/usr/app/dbt<br>      - AIRFLOW_HOME=/usr/app/dag<br>    volumes:<br>      - ./scr:/usr/app<br>      - gcloud-config:/root/.config<br>    secrets:<br>      - gcp_secret<br>  terraform:<br>    container_name: terraform<br>    entrypoint: ash<br>    image: hashicorp/terraform:latest<br>    working_dir: /tmp/terraform<br>    volumes:<br>      - ./scr/terraform:/tmp/terraform<br>      - gcloud-config:/root/.config<br>    tty: true<br>    secrets:<br>      - gcp_secret<br>  gcloud:<br>    container_name: gcloud<br>    entrypoint: &quot;gcloud&quot;<br>    image: google/cloud-sdk:alpine<br>    volumes:<br>      - gcloud-config:/root/.config<br>volumes:<br>  gcloud-config:<br>secrets:<br>  gcp_secret:<br>    file:<br>      {keyfile}</pre><p>main.tf:</p><pre>provider &quot;google&quot; {<br>  project     = var.gcp_project_id<br>  region      = &quot;us-central1&quot;<br>  credentials = &quot;${file(&quot;${var.GOOGLE_APPLICATION_CREDENTIALS}&quot;)}&quot;<br>}</pre><pre>resource &quot;google_bigquery_dataset&quot; &quot;bigquery_dataset&quot; {<br>  dataset_id    = &quot;sasakky_data_infra_dataset&quot;<br>  friendly_name = &quot;sasakky_data_infra_dataset&quot;<br>  location      = &quot;us-central1&quot;<br>}</pre><pre>resource &quot;google_storage_bucket&quot; &quot;cloud_storage_bucket&quot; {<br>  name = &quot;sasakky_gcs_bucket&quot;<br>  location      = &quot;us-central1&quot;<br>  force_destroy = true<br>  website {<br>    main_page_suffix = &quot;index.html&quot;<br>    not_found_page   = &quot;404.html&quot;<br>  }<br>}</pre><p>variable.tf:</p><pre>variable &quot;gcp_project_id&quot; {<br>  default = &quot;{project_id}&quot;<br>}<br>variable &quot;GOOGLE_APPLICATION_CREDENTIALS&quot; {<br>  default = &quot;/run/secrets/gcp_secret&quot;<br>}</pre><h3>Directory</h3><p>The directory structure is as follows.</p><pre>.<br>├── Dockerfile<br>├── docker-compose.yml<br>└── scr<br>    ├── dag（airflowの設定、DAGの配置など）<br>    ├── dbt（dbtプロジェクト）<br>    └── great_expectations（Great Expectationsプロジェクト）</pre><h3>Setting up Great Expectations</h3><p>Validation is applied to the customer table in BigQuery. Basically, <a href="https://medium.com/@Sasakky/how-to-use-great-expectations-with-bigquery-54aad4aa2dd">the previous article</a> is used, but some modifications have been made.<br>1) To upload Data Docs to GCS, add the following contents to great_expectations.yml.</p><pre>data_docs_sites:<br>  gs_site:<br>    class_name: SiteBuilder<br>    store_backend:<br>      class_name: TupleGCSStoreBackend<br>      project: {project_id}<br>      bucket: sasakky_gcs_bucket<br>    site_index_builder:<br>      class_name: DefaultSiteIndexBuilder</pre><p>(2) Removed unnecessary expectations from Suite, leaving only PK checks and Null checks.</p><pre>{<br>  &quot;data_asset_type&quot;: null,<br>  &quot;expectation_suite_name&quot;: &quot;customer_suite&quot;,<br>  &quot;expectations&quot;: [<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_be_unique&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;customer_id&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;customer_id&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;customer_name&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;gender_cd&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;gender&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;birth_day&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;age&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;postal_cd&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;address&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;application_store_cd&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;application_date&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    },<br>    {<br>      &quot;expectation_type&quot;: &quot;expect_column_values_to_not_be_null&quot;,<br>      &quot;kwargs&quot;: {<br>        &quot;column&quot;: &quot;status_cd&quot;<br>      },<br>      &quot;meta&quot;: {}<br>    }<br>  ],<br>  &quot;ge_cloud_id&quot;: null,<br>  &quot;meta&quot;: {<br>    &quot;great_expectations_version&quot;: &quot;0.14.12&quot;<br>  }<br>}</pre><h3>Setting up dbt</h3><p>Create a view with men extracted from the customer table.</p><pre>select<br>  *<br>from<br>  {{ source(&#39;sasakky_data_infra_dataset&#39;, &#39;customer&#39;) }}<br>where<br>  gender_cd = &quot;0&quot; -- gender_cd=0 means men</pre><p>Register the customer table as a source and write a test to see if transform is correctly executed for customers_men.</p><p>Schema.yml</p><pre>version: 2</pre><pre>sources:<br>  - name: sasakky_data_infra_dataset<br>    tables:<br>      - name: customer</pre><pre>models:<br>  - name: customers_men<br>    columns:<br>      - name: customer_id<br>        description: Primary key<br>        tests:<br>          - unique<br>          - not_null<br>      - name: gender_cd<br>        description: sex code（0：men）<br>        tests:<br>          - accepted_values:<br>              values: [&#39;0&#39;]<br>      - name: gender<br>        description: sex name<br>        tests:<br>          - accepted_values:<br>              values: [&#39;男性&#39;]</pre><h3>Setting up Airflow</h3><p>Once the Airflow web server is up and running, create a connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cFSd2YizGVvLQzGF.png" /></figure><p>The DAG file was written as follows: To handle dbt in Airflow, a library called <a href="https://pypi.org/project/airflow-dbt/">airflow-dbt</a> was used.</p><p>dag.py</p><pre>from datetime import timedelta<br>import os</pre><pre>from airflow import DAG<br>from airflow.operators.python_operator import PythonOperator<br>from airflow.hooks.base_hook import BaseHook<br>from airflow import AirflowException</pre><pre>from airflow_dbt.operators.dbt_operator import (<br>    DbtRunOperator,<br>    DbtTestOperator<br>)<br>from airflow.utils.dates import days_ago</pre><pre>default_args = {<br>  &#39;start_date&#39;: days_ago(0),<br>  &#39;retries&#39;: 0,<br>}</pre><pre>def validate(**context):<br>    from great_expectations.data_context import DataContext</pre><pre>conn = BaseHook.get_connection(&#39;sasakky_bigquery&#39;)<br>    connection_json = conn.extra_dejson<br>    os.environ[&#39;GOOGLE_APPLICATION_CREDENTIALS&#39;] = connection_json[&#39;extra__google_cloud_platform__key_path&#39;]</pre><pre>data_context: DataContext = DataContext(context_root_dir=&quot;/usr/app/great_expectations&quot;)</pre><pre>result = data_context.run_checkpoint(<br>        checkpoint_name=&quot;checkpoint_customer&quot;,<br>        batch_request=None,<br>        run_name=None,<br>    )</pre><pre>data_context.build_data_docs()</pre><pre>if not result[&quot;success&quot;]:<br>        raise AirflowException(&quot;Validation of the data is not successful &quot;)</pre><pre>with DAG(dag_id=&#39;etl&#39;, default_args=default_args, schedule_interval=&#39;<a href="http://twitter.com/daily">@daily</a>&#39;) as dag:<br>  ge_check = PythonOperator(<br>        task_id=&#39;validate&#39;,<br>        python_callable=validate,<br>        provide_context=True,<br>    )<br>  <br>  dbt_test = DbtTestOperator(<br>    task_id=&#39;dbt_test&#39;,<br>    retries=0,<br>    profiles_dir=&#39;/usr/app/dbt&#39;,<br>    dbt_bin=&#39;/usr/local/bin/dbt&#39;,<br>    dir=&#39;/usr/app/dbt&#39;<br>  )</pre><pre>dbt_run = DbtRunOperator(<br>    task_id=&#39;dbt_run&#39;,<br>    profiles_dir=&#39;/usr/app/dbt&#39;,<br>    dbt_bin=&#39;/usr/local/bin/dbt&#39;,<br>    dir=&#39;/usr/app/dbt&#39;<br>  )</pre><pre>ge_check &gt;&gt; dbt_run &gt;&gt; dbt_test</pre><h3>execution</h3><p>Trigger and execute a DAG in Airflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tEHsueeJ_uvuz2mE.png" /></figure><p>The process was successful to the end, check GCS to see the uploaded Data Docs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QJzLg-LJaaHJ08Vz.png" /></figure><p>Next, we will check the behavior when the validation fails for Great Expectations.<br>Set the birth_day column to null and run DAG again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nmjvMt-2h5hFCcSY.png" /></figure><p>The dbt task is not executed because the validation failed.<br>Data Docs shows it as FAILED.</p><h3>Consideration</h3><p>We were able to run the data pipeline test with Great Expectations and dbt.<br>It would be possible to get the latest version of the validation results periodically and detect anomalies in the data while scheduling with Airflow during production.</p><p>I think it is possible to run tests on data sources with dbt as well, so I am wondering how to distinguish between the two.<br>As mentioned in the video, testing of the actual data (in this case, checking for null, primary keys, and whether values are contained within a range, etc.) should be done with Great Expectations, and once that is ensured, testing of the data conversion logic (in this case, checking for the presence of male customers in customers_men) should be done with Great Expectations. Should dbt be used to test the data conversion logic (in this case, whether only male data is correctly extracted from customers_men)?</p><p>Since there may be strengths and weaknesses of each tool, we would like to do a more in-depth analysis of the testing on the dbt side.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d12b8bba030" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Use Great Expectations With BigQuery]]></title>
            <link>https://medium.com/@Sasakky/how-to-use-great-expectations-with-bigquery-54aad4aa2dd?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/54aad4aa2dd</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-management]]></category>
            <category><![CDATA[great-expectations]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Sat, 07 May 2022 04:00:31 GMT</pubDate>
            <atom:updated>2022-05-07T04:00:31.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*2ti_twliFriQn2NHS-lr8A.png" /></figure><h3>What’s this</h3><p>In researching tools to perform data quality control as part of data management, I came across a data quality control OSS called Great Expectations and tried the tutorial.</p><h3>What’s Great Expectations</h3><p>An OSS that can define data quality, test if the definition is met, document test results, and perform automated profiling.</p><p><a href="https://greatexpectations.io/">https://greatexpectations.io/</a></p><h3>Tutorial</h3><p>Based on the <a href="https://docs.greatexpectations.io/docs/tutorials/getting_started/tutorial_overview/">tutorial</a>, perform data quality testing against BigQuery tables.</p><h3>preparation</h3><h4>create tables</h4><p>customer table was created in BigQuery using the data <a href="https://github.com/The-Japan-DataScientist-Society/100knocks-preprocess/blob/master/docker/work/data/customer.csv">here</a>.<br>And, The following SQL will create a customer_error table with application_date set to null.</p><pre>create or replace table `{dataset_id}.customer_error`<br>as</pre><pre>SELECT <br>customer_id,<br>customer_name,<br>gender_cd,<br>gender,<br>birth_day,<br>age,<br>postal_cd,<br>address,<br>application_store_cd,<br>Null as application_date,<br>status_cd<br>FROM `{dataset_id}.customer`</pre><h4>build docker</h4><p>I prepared the following Docker.<br>To validate BigQuery tables, gcloud must be installed in the environment. docker-compose and Dockerfile must be on the same level.<br>The local authentication to GCP should be done in advance.</p><pre>gcloud auth application-default login</pre><p>dockerfile:</p><pre>FROM python:3.9-slim</pre><pre>RUN apt-get update -y &amp;&amp; \<br>    apt-get install --no-install-recommends -y -q \<br>    git libpq-dev python3-dev build-essential &amp;&amp; \<br>    apt-get clean &amp;&amp; \<br>    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*</pre><pre>RUN pip install --upgrade pip &amp;&amp; \<br>    # version 0.14.10<br>    pip install great_expectations &amp;&amp; \<br>    pip install sqlalchemy==1.4.25</pre><pre>ENV PYTHONIOENCODING=utf-8<br>ENV LANG C.UTF-8</pre><p>docker-compose.yml</p><pre>version: &#39;3.9&#39;</pre><pre>services:<br>  great_expectations:<br>    container_name: great_expectations<br>    build: .<br>    ports:<br>      - &quot;8888:8888&quot;<br>    tty: true<br>    working_dir: /usr/app<br>    volumes:<br>      - ./scr:/usr/app<br>      - gcloud-config:/root/.config<br>  gcloud:<br>    container_name: gcloud<br>    entrypoint: &quot;gcloud&quot;<br>    image: google/cloud-sdk:alpine<br>    volumes:<br>      - gcloud-config:/root/.config<br>volumes:<br>  gcloud-config:</pre><h4>init project</h4><p>Create a project with the following command.</p><pre>great_expectations init</pre><p>If successful, the required hierarchy and files are generated.<br>the definitions are <a href="https://docs.greatexpectations.io/docs/tutorials/getting_started/tutorial_setup#create-a-data-context">here</a>.</p><h4>connect datasource</h4><p>In this case, we want to connect to BigQuery, so we configure as follows.<br>Without — no-jupyter, jupyter will start up automatically. I wanted to specify ip, root settings, etc., so I specified — no-jupyter and ran it.</p><pre>root@7ea61c3fa821:/usr/app# great_expectations datasource new --no-jupyter<br>Using v3 (Batch Request) API</pre><pre>What data would you like Great Expectations to connect to?<br>    1. Files on a filesystem (for processing with Pandas or Spark)<br>    2. Relational database (SQL)<br>: 2</pre><pre>Which database backend are you using?<br>    1. MySQL<br>    2. Postgres<br>    3. Redshift<br>    4. Snowflake<br>    5. BigQuery<br>    6. other - Do you have a working SQLAlchemy connection string?<br>: 5</pre><pre>To continue editing this Datasource, run jupyter notebook /usr/app/great_expectations/uncommitted/datasource_new.ipynb</pre><p>Execute the following command to launch jupyter, access the link displayed, and open datasource_new.ipynb.</p><pre>root@7ea61c3fa821:/usr/app# jupyter notebook /usr/app/great_expectations/uncommitted/datasource_new.ipynb --allow-root --ip=0.0.0.0</pre><p>Run all cells with the following changes.</p><pre>datasource_name = &quot;{datasource_name}&quot;<br>connection_string = &quot;bigquery://{project_id}/{dataset_id}&quot;</pre><p>If it is done without error, the data source should have been successfully registered.<br>When I went to great_expectations.yml, the registered data source was present.</p><pre>datasources:<br>  &quot;{datasource_name}&quot;:<br>    module_name: great_expectations.datasource<br>    class_name: Datasource<br>    data_connectors:<br>      default_runtime_data_connector_name:<br>        module_name: great_expectations.datasource.data_connector<br>        class_name: RuntimeDataConnector<br>        batch_identifiers:<br>          - default_identifier_name<br>      default_inferred_data_connector_name:<br>        include_schema_name: true<br>        module_name: great_expectations.datasource.data_connector<br>        class_name: InferredAssetSqlDataConnector<br>    execution_engine:<br>      module_name: great_expectations.execution_engine<br>      class_name: SqlAlchemyExecutionEngine<br>      connection_string = &quot;bigquery://{project_id}/{dataset_id}&quot;<br>config_variables_file_path: uncommitted/config_variables.yml</pre><h4>create suite</h4><p>A Suite defines a combination of Expectations.<br>In creating a Suite, several built-in Profilers can be used.</p><pre>root@7ea61c3fa821:/usr/app# great_expectations suite new --no-jupyter<br>Using v3 (Batch Request) API</pre><pre>How would you like to create your Expectation Suite?<br>    1. Manually, without interacting with a sample batch of data (default)<br>    2. Interactively, with a sample batch of data<br>    3. Automatically, using a profiler<br>: 3</pre><pre>A batch of data is required to edit the suite - let&#39;s help you to specify it.</pre><pre>Select a datasource<br>    1. sasakky_bigquery<br>: 1</pre><pre>Which data asset (accessible by data connector &quot;default_inferred_data_connector_name&quot;) would you like to use?<br>    1. {データセット名}.customer<br>    2. {データセット名}.customer_error</pre><pre>Type [n] to see the next page or [p] for the previous. When you&#39;re ready to select an asset, enter the index.<br>: 1</pre><p>The Profiler needs a data set for analysis, and here it asks which data to use for this purpose.<br>Since the correct data is customer and what we want to validate this time is customer_error, we will analyze customer here and create a Suite.</p><pre>Name the new Expectation Suite [{データセット名}.customer.warning]: customer_suite</pre><pre>Great Expectations will create a notebook, containing code cells that select from available columns in your dataset and<br>generate expectations about them to demonstrate some examples of assertions you can make about your data.</pre><pre>When you run this notebook, Great Expectations will store these expectations in a new Expectation Suite &quot;customer_suite&quot; here:</pre><pre>file:///usr/app/great_expectations/expectations/customer_suite.json</pre><pre>Would you like to proceed? [Y/n]: Y</pre><p>If you name the Suite to be created this time and select Yes to the questions that follow, a JSON file of the Suite will be created in expectaions/.</p><pre>{<br>  &quot;data_asset_type&quot;: null,<br>  &quot;expectation_suite_name&quot;: &quot;customer_suite&quot;,<br>  &quot;expectations&quot;: [],<br>  &quot;ge_cloud_id&quot;: null,<br>  &quot;meta&quot;: {<br>    &quot;citations&quot;: [<br>      {<br>        &quot;batch_request&quot;: {<br>          &quot;data_asset_name&quot;: &quot;{dataset_name}.customer&quot;,<br>          &quot;data_connector_name&quot;: &quot;default_inferred_data_connector_name&quot;,<br>          &quot;datasource_name&quot;: &quot;sasakky_bigquery&quot;,<br>          &quot;limit&quot;: 1000<br>        },<br>        &quot;citation_date&quot;: &quot;2022-03-19T14:40:37.902540Z&quot;,<br>        &quot;comment&quot;: &quot;Created suite added via CLI&quot;<br>      }<br>    ],<br>    &quot;great_expectations_version&quot;: &quot;0.14.10&quot;<br>  }<br>}</pre><h4>create expectations</h4><p>Edit and run edit_customer_suite.ipynb to create Expectations.<br>Here we use the Python API of Great Expectations via Jupyter Notebook.</p><p>The first cell imports various libraries, loads data and creates Validation.</p><pre>import datetime</pre><pre>import pandas as pd</pre><pre>import great_expectations as ge<br>import great_expectations.jupyter_ux<br>from great_expectations.core.batch import BatchRequest<br>from great_expectations.profile.user_configurable_profiler import UserConfigurableProfiler<br>from great_expectations.checkpoint import SimpleCheckpoint<br>from great_expectations.exceptions import DataContextError</pre><pre>context = ge.data_context.DataContext()</pre><pre>batch_request = {&#39;datasource_name&#39;: &#39;sasakky_bigquery&#39;, &#39;data_connector_name&#39;: &#39;default_inferred_data_connector_name&#39;, &#39;data_asset_name&#39;: &#39;{dataset_name}.customer&#39;, &#39;limit&#39;: 1000}</pre><pre>expectation_suite_name = &quot;customer_suite&quot;</pre><pre>validator = context.get_validator(<br>    batch_request=BatchRequest(**batch_request),<br>    expectation_suite_name=expectation_suite_name<br>)<br>column_names = [f&#39;&quot;{column_name}&quot;&#39; for column_name in validator.columns()]<br>print(f&quot;Columns: {&#39;, &#39;.join(column_names)}.&quot;)<br>validator.head(n_rows=5, fetch_all=False)<br></pre><p>In the second cell, select the columns that do not need to be validated.<br>Here we want to check application_date, so comment it out.</p><pre>ignored_columns = [<br>    &quot;customer_id&quot;,<br>    &quot;customer_name&quot;,<br>    &quot;gender_cd&quot;,<br>    &quot;gender&quot;,<br>    &quot;birth_day&quot;,<br>    &quot;age&quot;,<br>    &quot;postal_cd&quot;,<br>    &quot;address&quot;,<br>    &quot;application_store_cd&quot;,<br>    # &quot;application_date&quot;,<br>    &quot;status_cd&quot;,<br>]</pre><p>Instantiate UserConfigurableProfiler and create a Suite. Pass some customized parameters.</p><pre>profiler = UserConfigurableProfiler(<br>    profile_dataset=validator,<br>    excluded_expectations=[&quot;expect_table_columns_to_match_ordered_list&quot;,&quot;expect_column_values_to_be_in_set&quot;,&quot;expect_table_row_count_to_be_between&quot;,&quot;expect_column_proportion_of_unique_values_to_be_between&quot;,&quot;expect_column_values_to_be_in_type_list&quot;],<br>    ignored_columns=ignored_columns,<br>    not_null_only=False,<br>    primary_or_compound_key=[&quot;customer_id&quot;],<br>    semantic_types_dict=None,<br>    table_expectations_only=False,<br>    value_set_threshold=&quot;many&quot;,<br>)<br>suite = profiler.build_suite()</pre><p>The last cell saves the Suite to disk, performs Validation on the loaded data, and creates Data Docs.</p><pre>print(validator.get_expectation_suite(discard_failed_expectations=False))<br>validator.save_expectation_suite(discard_failed_expectations=False)</pre><pre>checkpoint_config = {<br>    &quot;class_name&quot;: &quot;SimpleCheckpoint&quot;,<br>    &quot;validations&quot;: [<br>        {<br>            &quot;batch_request&quot;: batch_request,<br>            &quot;expectation_suite_name&quot;: expectation_suite_name<br>        }<br>    ]<br>}<br>checkpoint = SimpleCheckpoint(<br>    f&quot;_tmp_checkpoint_{expectation_suite_name}&quot;,<br>    context,<br>    **checkpoint_config<br>)<br>checkpoint_result = checkpoint.run()</pre><pre>context.build_data_docs()</pre><pre>validation_result_identifier = checkpoint_result.list_validation_result_identifiers()[0]<br>context.open_data_docs(resource_identifier=validation_result_identifier)</pre><h4>validation</h4><p>Run Validation to create Checkpoint.<br>Create the following command in the terminal.</p><pre>great_expectations checkpoint new checkpoint_customer</pre><p>Edit the Jupyter Notebook that is up and running.</p><pre>my_checkpoint_name = &quot;checkpoint_customer&quot; # This was populated from your CLI command.</pre><pre>yaml_config = f&quot;&quot;&quot;<br>name: {my_checkpoint_name}<br>config_version: 1.0<br>class_name: SimpleCheckpoint<br>run_name_template: &quot;%Y%m%d-%H%M%S-my-run-name-template&quot;<br>validations:<br>  - batch_request:<br>      datasource_name: sasakky_bigquery<br>      data_connector_name: default_inferred_data_connector_name<br>      data_asset_name: {dataset_name}.customer_error -- edit here<br>      data_connector_query:<br>        index: -1<br>    expectation_suite_name: customer_suite<br>&quot;&quot;&quot;<br>print(yaml_config)</pre><p>Also, uncomment out the following.</p><pre>context.run_checkpoint(checkpoint_name=my_checkpoint_name)<br>context.open_data_docs()</pre><p>Once all cells are executed, Data Docs are created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eOuqRyKTybhislu4.png" /></figure><p>The application_date column, which is not allowed to be null, is failing if it is 100% null.<br>The unique key constraint for customer_id specified in PK is passed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54aad4aa2dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing a data management strategy for a startup]]></title>
            <link>https://medium.com/@Sasakky/developing-a-data-management-strategy-for-a-startup-59d9792deadb?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/59d9792deadb</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-management]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Tue, 03 May 2022 07:38:33 GMT</pubDate>
            <atom:updated>2022-05-03T07:38:33.791Z</atom:updated>
            <content:encoded><![CDATA[<h3>What’s this</h3><p>An overview of how a data engineer in a startup proceeds to develop a company-wide data management strategy in three months.</p><h3>Background</h3><p>A startup with 30 employees. No data organization.</p><h3>Schedule</h3><p>The overall schedule for the project is as follows.</p><ul><li>First Month: I joined this company and catch up on organization, data management and data infrastructure building, etc. Drafted a data management project to executives and got approval.</li><li>Second Month: Project started. Collect use cases from business users. Organize the use cases and made the data utilization strategy.</li><li>Third Month: Submitted in the data utilization strategy. Investigated the use cases and identified the necessary data.</li><li>Final Month: Made the data management policy and strategy. Finally submitted it to the executives.</li></ul><h3>Team</h3><p>Main members of the team are as follows.</p><ul><li>CEO</li><li>Corporate Planner</li><li>Data Engineer(me)</li></ul><p>some business members are included so that we could hear from them about their data use cases.</p><h3>Building Team</h3><p>Since data management cannot be achieved by a data engineer alone, it was necessary to involve the business department in our team. (Because the data that should be aggregated in the data infrastructure must be combined with its use case.)<br>Therefore, we explained the current data challenges and mid- to long-term competitive risks due to the lack of data management activities and data analysis infrastructure at the executive meeting, and succeeded in getting the people in charge of each business unit assigned to the project for the time being.</p><h3>Collecting Use Cases</h3><p>We asked the people in charge of each business unit to describe the anticipated use cases for data utilization in the short, medium, and long term.</p><h3>Grouping Use Cases and Making Data Utilization Policy</h3><p>Since the ideas that came from business users tended to be shortsighted and tied to the most recent business needs, we grouped the use cases and generalized.<br>We then formulated KGIs that we wanted to improve with data, prioritized them based on the company-wide management strategy, defined them as data utilization policies, and proposed them to the management.<br>For the use cases that were given lower priority, many of them had not yet obtained data or the KPI definitions themselves were unstable, so we decided to narrow the scope to use cases from the most recent year for which we had a clear picture of what we needed to do.</p><h3>Investigating Use Cases</h3><p>Now that the data utilization policy had been defined, we brought together the personnel from related departments, including marketing and product manager, to review use cases to determine what kind of data utilization should be done in order to increase the KGIs that should be prioritized for the most recent one year.<br>At this point, the scope of the project was narrowed down considerably, and we were able to come up with a more concrete proposal than we had initially identified.<br>The use cases that were explored in depth were prioritized from both quantitative and qualitative perspectives based on their contribution to KGIs, and based on customer surveys and interviews.</p><h3>Identification of necessary data</h3><p>We defined the conceptual data level to determine what kind of data is needed to realize the use cases determined above.</p><h3>building data management strategy</h3><p>In this section, we defined specific policies for “data status and structure” and “organization, rules, and human resource infrastructure” that we want to achieve as a company in order to realize the use cases.<br>Then, we defined the specific initiatives needed to realize those policies in a one-to-one manner with the policies.<br>We drafted the defined data management policy, strategy, and realization roadmap to management.</p><h3>Next Action</h3><p>Following the roadmap, we will proceed to materialize the establishment of a data management organization, formulation of rules for data management and utilization, improvement of business processes to improve data quality, development of data analysis infrastructure, and definition of data human resource requirements.<br>Since we do not have enough people at all, we would like to generate progress at a blistering pace with a minimum scope of data and with an awareness of first creating one successful case study.</p><h3>Review</h3><p>At first, we had no idea where to start, so we repeatedly created and destroyed the contents of the interim deliverables while looking at various books and websites.<br>In the end, we were satisfied with the final product in terms of quality and delivery, and I think this was due in part to the considerable amount of research we did and the fact that we had an organization that was not overloaded.<br>On the other hand, I regret that it took time to get the business department, which did not have much knowledge of data to begin with, to understand how to proceed with data management and data infrastructure. (I don’t know much about it myself to begin with.)<br>I can only hope to move on to system development as soon as possible, but there are many things that need to be considered first, so I hope to steadily handle them one by one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59d9792deadb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom validation using Google App Script and loading data into BigQuery]]></title>
            <link>https://medium.com/@Sasakky/custom-validation-using-google-app-script-and-loading-data-into-bigquery-e0266e49d381?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0266e49d381</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[google-app-script]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Sun, 01 May 2022 12:08:30 GMT</pubDate>
            <atom:updated>2022-05-01T12:08:30.392Z</atom:updated>
            <content:encoded><![CDATA[<h3>Background and Objectives</h3><p>In order to create a dashboard, we needed to load data from a spreadsheet into a table in BigQuery.<br>Since the spreadsheet was updated manually, there was a high possibility of incorrect data being included, and we wanted to ensure that only quality-assured data is included in BigQuery.</p><h3>Assumption</h3><ul><li>Using Google Cloud Platform as a development environment.</li><li>Google Cloud Platform is used by another team as well</li></ul><h3>Options</h3><p>Merit-deficit comparison in light of the company’s situation at the time.</p><ol><li>Convert spreadsheets directly into external tables</li><li>Upload to GCS and transport into BigQuery with Cloud Functions</li><li>Upload to GCS and transfer intoBigQuery with BigQuery Data Transfer Service</li><li>Transfer from Spreadsheet with Google App Script</li></ol><p>We wanted to execute validation before loading data into BigQuery, and<br>because of delivery constraints, we wanted to complete the development in our own team if possible.<br>So we chose to load data in Google App Script.</p><h3>Requirement</h3><ol><li>Validate the spreadsheet contents in Google App Script.</li><li>Once validated, load it into BigQuery.</li></ol><h4>Data Specification</h4><p>The contents of the table to which the spreadsheet is loaded are defined as follows.</p><ul><li>id(STRING):unique id</li><li>year(STRING)</li><li>month(STRING)</li><li>weekday(STRING)</li><li>num(INT)</li></ul><h4>Valiation</h4><ol><li>id is unique</li><li>year ≥ 2022</li><li>month between 1 and 12</li><li>weekday between Monday and Sunday</li><li>each column doesn’t have null</li><li>sheet has all columns</li></ol><h4>Load</h4><ul><li>project:”YOUR_OWN_PROJECT_ID”</li><li>dataset:”YOUR_OWN_DATASET_ID”</li><li>table:”target_table”</li></ul><h3>Coding</h3><h4>validation.js</h4><pre>function validateData(sheet) {<br>  <br>  // get last row in spreadsheet<br>  var lastRow = sheet.getLastRow();</pre><pre>// get range for validation<br>  var colId = sheet.getRange(2, getCol(&quot;id&quot;, sheet), lastRow-1).getValues()<br>  var colYear = sheet.getRange(2, getCol(&quot;year&quot;, sheet), lastRow-1).getValues()<br>  var colMonth = sheet.getRange(2, getCol(&quot;month&quot;, sheet), lastRow-1).getValues()<br>  var colWeekDay = sheet.getRange(2, getCol(&quot;weekday&quot;, sheet), lastRow-1).getValues()<br>  <br>  // create validation rules<br>  var errorId = colId.flat().filter(function(value, i, self){<br>    return (self.indexOf(value) === i &amp;&amp; i !== self.lastIndexOf(value)) || value == &quot;&quot;<br>  });<br>  var errorYear = colYear.filter(function(value){<br>    return Number(value)&lt;2022<br>  });<br>  var errorMonth = colMonth.filter(function(value){<br>    const pattern = [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;, &quot;6&quot;, &quot;7&quot;, &quot;8&quot;, &quot;9&quot;, &quot;10&quot;, &quot;11&quot;, &quot;12&quot;];<br>    return pattern.indexOf(String(value))==-1<br>  });<br>  var errorWeekDay = colWeekDay.filter(function(value){<br>    const pattern = [&quot;Monday&quot;, &quot;Tuesday&quot;, &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;, &quot;Sunday&quot;];<br>    return pattern.indexOf(String(value))==-1<br>  });</pre><pre>var errorLengthDict = {<br>    &quot;id&quot; : errorId.length,<br>    &quot;year&quot; : errorYear.length,<br>    &quot;month&quot; : errorMonth.length,<br>    &quot;weekday&quot; : errorWeekDay.length<br>  }<br>  <br>  // sum the number of errors<br>  const errorSum = Object.values(errorLengthDict).reduce((prev, current) =&gt; prev + current, 0);</pre><pre>// return True if there is not any error<br>  if(errorSum==0){<br>    return true<br>  }else{<br>    var errorDict = {<br>    &quot;id&quot; : errorId,<br>    &quot;year&quot; : errorYear,<br>    &quot;month&quot; : errorMonth,<br>    &quot;weekday&quot; : errorWeekDay<br>  }<br>    throw new Error(&quot;validation rule error&quot;);<br>  }</pre><pre>}</pre><pre>// Specify a column name and return the corresponding column number. // If the corresponding column is not in IF, an error is thrown.<br>function getCol(string, sheet) {<br>  var lastCol = sheet.getLastColumn();  <br>  var range = sheet.getRange(1, 1, 1, lastCol)  <br>  var values = range.getValues()[0];</pre><pre>for (i=0; i&lt;lastCol; i++) {<br>    if (values[i] == string) {<br>      return i + 1; // return column no<br>    }<br>  }<br>  throw new Error(&#39;file does not have the column:&#39;+string);<br>}</pre><h4>insert.js</h4><pre>function insertData(sheet, projectId, datasetId, tableId) {<br>  const jsonl = getData(sheet);</pre><pre>const data = Utilities.newBlob(jsonl);<br>  const resultInsert = BigQuery.Jobs.insert({<br>    configuration: {<br>      load: {<br>        destinationTable: { projectId, datasetId, tableId },<br>        sourceFormat: &#39;NEWLINE_DELIMITED_JSON&#39;<br>      }<br>    }<br>  }, projectId, data);<br>  return resultInsert;<br>}</pre><pre>// get data <br>function getData(sheet) {<br>  const maxRow = sheet.getLastRow();<br>  const maxColumn = sheet.getLastColumn();</pre><pre>  const keys = [];</pre><pre>  const data = [];</pre><pre>  for (var x = 1; x &lt;= maxColumn; x++) {<br>    keys.push(sheet.getRange(1, x).getValue());<br>  }</pre><pre>  const _values = sheet.getRange(2, 1, maxRow-1, maxColumn).getValues();<br>  <br>  for(var i = 0; i &lt; _values.length; i++){<br>    const json = {};<br>    for (var k = 0; k &lt; _values[i].length; k++) {<br>      json[keys[k]] = _values[i][k];<br>    }<br>    data.push(json);<br>  }</pre><pre>  return data.map(o =&gt; JSON.stringify(o)).join(&#39;\n&#39;);<br>}</pre><h4>main.js</h4><pre>function main() {<br>  // Specify sheet information to acquire data<br>  const spreadSheet = SpreadsheetApp.openByUrl(&quot;{スプレッドシートURL}&quot;);<br>  const sheet = spreadSheet.getSheetByName(&quot;{シート名}&quot;);</pre><pre>// Specify the table information to be updated<br>  const projectId = &quot;{YOUR_OWN_PROJECT_ID}&quot;;<br>  const datasetId = &quot;{YOUR_OWN_DATASET_ID}&quot;;<br>  const tableId = &quot;target_table&quot;;<br>  <br>  try{<br>    // execute validation<br>    var resultValidation = validateData(sheet);</pre><pre>// If validation is passed, insert is executed<br>    if(resultValidation){<br>      console.log(&quot;validation passed&quot;);<br>      resultInsert = insertData(sheet, projectId, datasetId, tableId);<br>    }<br>  }catch(e){<br>    console.error(e.message);<br>  }<br>}</pre><h3>important point</h3><p>The account running Google App Script must have BigQuery editing privileges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0266e49d381" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write unit test with BigQuery]]></title>
            <link>https://medium.com/@Sasakky/how-to-write-unit-test-with-bigquery-8a332cef1b29?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a332cef1b29</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[unittest]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Fri, 29 Apr 2022 07:08:39 GMT</pubDate>
            <atom:updated>2022-04-29T07:08:39.020Z</atom:updated>
            <content:encoded><![CDATA[<p>I joined as the first person in charge of data infrastructure and was assigned to do the first data mart development, but I was wondering how to implement SQL unit tests.<br>Although we are considering to introduce dbt or dataform later, we decided to write the test code on BigQuery for the first time to prioritize delivery.</p><h3>Challenge</h3><p>I want to write unit tests for BigQuery using only SQL to make testing more efficient.</p><p>The entire code is as follows.</p><pre>declare input_test_code int64 default 1;</pre><pre>begin</pre><pre>-- create test data<br>create or replace table function {dataset}.test_data(input_test_code int64) as <br>  select<br>    * except(test_code)<br>  from<br>    unnest([<br>        struct<br>        (&quot;xxx&quot; as user_id, &quot;apple&quot; as product_name, 120 as price, date(&quot;2022-01-11&quot;) as purchase_date, 1 as test_code),<br>        (&quot;yyy&quot;, &quot;banana&quot;, 100, date(&quot;2022-01-11&quot;), 1),<br>        (&quot;zzz&quot;, &quot;orange&quot;, 80, date(&quot;2022-01-12&quot;), 1)        <br>    ])<br>  where<br>    test_code=input_test_code;</pre><pre>-- create expected data<br>create or replace table function {dataset}.expected_data(input_test_code int64) as <br>  select<br>    * except(test_code)<br>  from<br>    unnest([<br>        struct<br>        (date(&quot;2022-01-11&quot;) as purchase_date, 220 as sum_price, 1 as test_code),<br>        (date(&quot;2022-01-12&quot;), 80, 1)<br>    ])<br>  where<br>    test_code=input_test_code;</pre><pre>-- Execute SQL against test data and create result data<br>create or replace table function {dataset}.actual_data(input_test_code int64) as <br>  select<br>    purchase_date,<br>    sum(price) as sum_price<br>  from<br>    {dataset}.test_data(input_test_code)<br>  group by<br>    purchase_date;</pre><pre>-- Test whether test data execution results match expected data<br>WHILE input_test_code &lt;= 1 DO<br>  assert (<br>    (<br>      select count(*) from (<br>        select * from (select * from {dataset}.actual_data(input_test_code) except distinct select * from {dataset}.expected_data(input_test_code)) union all <br>        select * from (select * from {dataset}.expected_data(input_test_code) except distinct select * from {dataset}.actual_data(input_test_code))<br>      ) <br>    ) = 0<br>  ) as &quot;not equal&quot;;<br>  set input_test_code = input_test_code + 1;<br>END WHILE;</pre><pre>-- Delete temporarily created resources<br>DROP TABLE FUNCTION {dataset}.test_data;<br>DROP TABLE FUNCTION {dataset}.expected_data;<br>DROP TABLE FUNCTION {dataset}.actual_data;</pre><pre>end</pre><p>Explain the individual parts.</p><h3><strong>Create test data and expected result data</strong></h3><p>I created a table of test data and expected results using a table function.<br>We want to create it as a temporary function, but table functions cannot be made temporary, so we created it as a persistent function.<br>The test code is passed as an argument, and the data required by the test you want to run is extracted.</p><pre>create or replace table function {dataset}.test_data(input_test_code int64) as <br>  select<br>    * except(test_code)<br>  from<br>    unnest([<br>        struct<br>        (&quot;xxx&quot; as user_id, &quot;apple&quot; as product_name, 120 as price, date(&quot;2022-01-11&quot;) as purchase_date, 1 as test_code),<br>        (&quot;yyy&quot;, &quot;banana&quot;, 100, date(&quot;2022-01-11&quot;), 1),<br>        (&quot;zzz&quot;, &quot;orange&quot;, 80, date(&quot;2022-01-12&quot;), 1)        <br>    ])<br>  where<br>    test_code=input_test_code;</pre><pre>create or replace table function {dataset}.expected_data(input_test_code int64) as <br>  select<br>    * except(test_code)<br>  from<br>    unnest([<br>        struct<br>        (date(&quot;2022-01-11&quot;) as purchase_date, 220 as sum_price, 1 as test_code),<br>        (date(&quot;2022-01-12&quot;), 80, 1)<br>    ])<br>  where<br>    test_code=input_test_code;</pre><h3>Create result table</h3><p>Create a table function that plugs in test data, executes logic, and generates result data.</p><pre>create or replace table function {dataset}.actual_data(input_test_code int64) as <br>  select<br>    purchase_date,<br>    sum(price) as sum_price<br>  from<br>    {dataset}.test_data(input_test_code)<br>  group by<br>    purchase_date;</pre><h3>Comparison of test execution results with expected execution results</h3><p>The test codes are inserted in order, and the tests you want to try are executed in batches.<br>What we are doing is simply checking whether the expected result matches the executed result.<br>In this case, there is only one test case, but multiple tests can be added and executed for the same SQL.<br>If they all pass, the job status =success, and if they do not match, a “not equal” error is output.</p><pre>WHILE input_test_code &lt;= 1 DO<br>  assert (<br>    (<br>      select count(*) from (<br>        select * from (select * from {dataset}.actual_data(input_test_code) except distinct select * from {dataset}.expected_data(input_test_code)) union all <br>        select * from (select * from {dataset}.expected_data(input_test_code) except distinct select * from {dataset}.actual_data(input_test_code))<br>      ) <br>    ) = 0<br>  ) as &quot;not equal&quot;;<br>  set input_test_code = input_test_code + 1;<br>END WHILE;</pre><h3>Deleting Resources</h3><p>Finally, the resources used in the test are not needed and should be deleted.</p><pre>DROP TABLE FUNCTION {dataset}.test_data;<br>DROP TABLE FUNCTION {dataset}.expected_data;<br>DROP TABLE FUNCTION {dataset}.actual_data;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a332cef1b29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EOS Weekend 一日目参加レポート ③パネルディスカッション]]></title>
            <link>https://medium.com/hashhub/eos-weekend-%E4%B8%80%E6%97%A5%E7%9B%AE%E5%8F%82%E5%8A%A0%E3%83%AC%E3%83%9D%E3%83%BC%E3%83%88-%E2%91%A2%E3%83%91%E3%83%8D%E3%83%AB%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AB%E3%83%83%E3%82%B7%E3%83%A7%E3%83%B3-e6b032d4859?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6b032d4859</guid>
            <category><![CDATA[community]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Sat, 10 Nov 2018 04:21:01 GMT</pubDate>
            <atom:updated>2018-11-10T04:21:01.391Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsk5wOuntRsxX3XUYCfiDA.jpeg" /></figure><p>最後のパネルディスカッションでは、世界に21しかないEOSエコシステムのBlock Producersのうち、日本を拠点を置く「EOSLaomao」「JEDA」の二社から、開発者のZhao YuさんとJackyさんにそれぞれお越しいただき、BPの役割やEOS全体の将来像についてお話していただきました。内容は、@meikamiyamoto97(<a href="https://twitter.com/meikamiyamoto97">https://twitter.com/meikamiyamoto97</a>)さんのまとめを参照させていただきました。</p><p>①EOSのアドバンテージとは？<br>Jackie(以下、J)「ハイパフォーマンスで、手数料がいらないこと。」<br>Zhao(以下、Z)「同意。特にメインネットになってからUXも進化している。EOSは新しいブロックチェーンであり、どのようにゴールまで達成するか模索中だが、スピードが特に特長的だ。」</p><p>②いちおしのDappsは？<br>Z「Bank of StakedとPictureなんとか。これは写真の売買ができ、非常にスマートである。本当にカッコイイ。」<br>J「BetDice。なぜならベットしてすぐに結果が欲しいゲームにおいて、ハイパフォーマンスなEOSは相性が良い。カジノの公平性も担保できる。」</p><p>③EOSの問題は？<br>J「やはりガバナンスの問題。」<br>Z「ガバナンスの問題。BPは非常に大変だし、ブラックリストがあるし、ハッキングに目を光らせないといけない。ECAFの正当性についても疑問が出てくることがある。あとはインターチェーンについても問題。EOSはハイパフォーマンスだが、やはりCPUが高いのでそこを解決しないとたくさんの人は使ってくれない。いずれにしろ垂直的・水平的に問題解決する必要ある」</p><p>④アカウントを作ることに手間がかかる問題についてはどう思うか？<br>Z「他のETHなどは秘密鍵の手間があるけどEOSは他人にアカウント作ってもらえるからあまり問題ではない。しかも、BlockoneはEOSウォレットを作って解決しようとしている。また他のサービスもEOSのアカウントをタダで作れるようにしてくれるし、JEDAも色々動いているところだ。」</p><p>⑤今後のEOSについて期待することは？<br>Z「EVMとの互換性については半年以内に実現するだろう。思うに、サードパーティソリューションあるはず。一年以内に大衆にDappsが浸透し、developerも増えることを期待している。今もアクティブユーザー多いが、より増えてほしい。」<br>J「TPSについては、より速くなってほしいと思う。BPはすべてのCPUパフォーマンスを監視しているが、CPUについてはあまり使い勝手が良くないと思う。」</p><p>以上、EOSの概要とエコシステムについてのイベントのまとめでした。</p><p>全体的にEOSの基礎的な部分から踏み入った話まで行われていて、様々なレベルの人にとって有益なイベントであったのではないかと思います。21のBPによって運営されているEOSは、真の意味でDecentralizedであるのか度々議論が起きますが、エコシステムの公正性を保つ上でBP同士様々な試行錯誤をかさねているようです。また、EOSユーザーとなる我々自身も、BPsを全面的にトラストするのではなく、常に監視する心持ちを持つことも重要であるように感じます。</p><p>HashHubでは、このように他にはない良質なイベントを継続的に実施していく予定ですので、興味がある方はぜひ遊びにいらしてください。</p><p>＊お知らせ<br>HashHubは、ブロックチェーン業界で働いている人のためのコワーキングスペースを運営しています。<br>ご利用希望者は、webサイトからお問い合わせください。 →<a href="https://hashhub.tokyo/">https://hashhub.tokyo/</a></p><p>現在、HashHubでは採用を行なっています。<br>・ コミュニティマネージャー<br>・ブロックチェーン技術者・開発者<br>・ビジネスディベロップメント<br>の3ポジションを募集しています。詳細はWantedlyのページをご覧ください。<br>→<a href="https://www.wantedly.com/companies/hashhub/projects">https://www.wantedly.com/companies/hashhub/projects</a></p><p>HashHubに関する最新情報はTwitterをフォローして下さい。<a href="https://twitter.com/HashHub_Tokyo">https://twitter.com/HashHub_Tokyo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6b032d4859" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashhub/eos-weekend-%E4%B8%80%E6%97%A5%E7%9B%AE%E5%8F%82%E5%8A%A0%E3%83%AC%E3%83%9D%E3%83%BC%E3%83%88-%E2%91%A2%E3%83%91%E3%83%8D%E3%83%AB%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AB%E3%83%83%E3%82%B7%E3%83%A7%E3%83%B3-e6b032d4859">EOS Weekend 一日目参加レポート ③パネルディスカッション</a> was originally published in <a href="https://medium.com/hashhub">HashHub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EOS Weekend 一日目参加レポート ②EOS上のリソース調達コストと使用状況、PoS型のベースプロトコルの将来像]]></title>
            <link>https://medium.com/hashhub/eos-weekend-%E4%B8%80%E6%97%A5%E7%9B%AE%E5%8F%82%E5%8A%A0%E3%83%AC%E3%83%9D%E3%83%BC%E3%83%88-%E2%91%A1eos%E4%B8%8A%E3%81%AE%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E8%AA%BF%E9%81%94%E3%82%B3%E3%82%B9%E3%83%88%E3%81%A8%E4%BD%BF%E7%94%A8%E7%8A%B6%E6%B3%81-pos%E5%9E%8B%E3%81%AE%E3%83%99%E3%83%BC%E3%82%B9%E3%83%97%E3%83%AD%E3%83%88%E3%82%B3%E3%83%AB%E3%81%AE%E5%B0%86%E6%9D%A5%E5%83%8F-a846c5b79397?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a846c5b79397</guid>
            <category><![CDATA[community]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Fri, 09 Nov 2018 03:19:58 GMT</pubDate>
            <atom:updated>2018-11-09T03:19:58.201Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yhm8Mv6tQ9_PmkapDW6vGQ.jpeg" /></figure><p>二番目は、アットコイン株式会社CEOで、EOS周辺のサービス開発や外部企業の開発支援に取り組まれている野原さん(@shusuke_nohara)に、EOSのリソースシステムやEOSのビジネス応用などについて紹介していただきました。</p><h3><strong>EOSのリソースシステムについて</strong></h3><p>・EOSの特徴<br>①高速なトランザクションが可能<br>②手数料ゼロでブロックチェーンが利用できる<br>（ただし、EOSは送金の際にいくらかのEOSをstakeする必要がある。stakeしたEOSは解除してから３日後から使えるので、預けたお金が返ってくるという意味で「手数料がゼロ」と呼んでいる。）</p><p>・トランザクション送信、計算コスト、データの保存の３つの性質の異なる処理に対し、それぞれ別個のリソースを使用する。（後述）</p><p>・スマートコントラクトはアカウントによって保持される<br>コントラクトは常に開発したヒトのアカウントの中に存在し、「コントラクトを使うユーザーはリソースを用意しなくてもいい」、というような設計もできるので、柔軟なサービス設計が可能である。</p><p>・codeのアップデートが可能</p><h3><strong>EOSにおける３つのリソース</strong></h3><p>①RAM：EOSのブロックチェーン上に保存できるデータの数<br>②NET：直近72hでどれだけデータを送信できるのかを示す数 データの量と重さ<br>③CPU：直近72hで使用可能なCPU時間</p><p>・それぞれをどうやって調達するのか<br>NETとCPUは全く一緒で、EOSトークンをstakeすることで入手可能。さらに第三者による実行でも調達可能である。一方で、RAMはEOSトークンを払って自分で買う必要がある。このとき、第三者が買うことはできない。</p><p>・EOS上のリソース利用の実例<br>①RAMを消費するコントラクト<br>Ex. Everipedia：大量に情報を載せていかないといけないのでRAMを大量に消費する<br>②CPUを消費するコントラクト<br>Ex. BetDice：ギャンブルゲームは、オンチェーンで情報の透明性を担保しないといけないので複雑な処理が必要。<br>③NETを消費するコントラクトはあまり見たことがない</p><h3><strong>EOSのビジネスへの応用</strong></h3><p>ポイント①：手数料ゼロでブロックチェーンが利用できる。<br>→オフチェーンの情報をリアルタイムでオンチェーンに取り込む</p><p>ポイント②：スマートコントラクトはアカウントによって保持される。<br>→外部の第三者によるコードの監視サービス<br>EOSは継続的にコードの書き換えが可能であるため、ハッキングにより悪意あるコードに改変される恐れがある。そのため継続的なコード監視が必要となる。</p><p>ポイント③：第三者によるリソース調達代行<br>→delegateによる資産運用<br>Ex. トークンホルダーが開発者にリソースを提供し、それに対して開発者は金利2%とかをトークンホルダーに提供するなど。</p><p>当日の資料は下記より見る事が可能です。</p><p><a href="https://speakerdeck.com/shusukenohara/eos-weekend-fa-biao-zi-liao">https://speakerdeck.com/shusukenohara/eos-weekend-fa-biao-zi-liao</a></p><p>以上となります。EOSのリソース周りの話は深く調べたことがなかったのですが、知識不足の僕にも非常に簡潔でわかりやすい説明でした。Ethereumと比較したときのビジネスでの応用分野の違いが興味深かったのですが、今後多様なチェーンが現れ、その上でサービスがローンチされる度に、各チェーンごとに異なるサポートビジネスが生じてくる可能性を考えると、ブロックチェーンが生み出すサポートビジネスの領域は広いなと感じました。（どこかのチェーンに集約されるかもしれませんが）</p><p>＊お知らせ</p><p>HashHubは、ブロックチェーン業界で働いている人のためのコワーキングスペースを運営しています。<br>ご利用希望者は、webサイトからお問い合わせください。 →<br><a href="https://hashhub.tokyo/">https://hashhub.tokyo/</a></p><p>現在、HashHubでは採用を行なっています。<br>・ コミュニティマネージャー<br>・ブロックチェーン技術者・開発者<br>・ビジネスディベロップメント<br>の3ポジションを募集しています。詳細はWantedlyのページをご覧ください。→<br><a href="https://www.wantedly.com/companies/hashhub/projects">https://www.wantedly.com/companies/hashhub/projects</a></p><p>HashHubに関する最新情報はTwitterをフォローして下さい。<br><a href="https://twitter.com/HashHub_Tokyo">https://twitter.com/HashHub_Tokyo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a846c5b79397" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashhub/eos-weekend-%E4%B8%80%E6%97%A5%E7%9B%AE%E5%8F%82%E5%8A%A0%E3%83%AC%E3%83%9D%E3%83%BC%E3%83%88-%E2%91%A1eos%E4%B8%8A%E3%81%AE%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E8%AA%BF%E9%81%94%E3%82%B3%E3%82%B9%E3%83%88%E3%81%A8%E4%BD%BF%E7%94%A8%E7%8A%B6%E6%B3%81-pos%E5%9E%8B%E3%81%AE%E3%83%99%E3%83%BC%E3%82%B9%E3%83%97%E3%83%AD%E3%83%88%E3%82%B3%E3%83%AB%E3%81%AE%E5%B0%86%E6%9D%A5%E5%83%8F-a846c5b79397">EOS Weekend 一日目参加レポート ②EOS上のリソース調達コストと使用状況、PoS型のベースプロトコルの将来像</a> was originally published in <a href="https://medium.com/hashhub">HashHub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EOS WeekEnd 一日目参加レポート ①EOSエコシステムとEOSを使ったDAppsの事例紹介]]></title>
            <link>https://medium.com/hashhub/eos-weekend-%E4%B8%80%E6%97%A5%E7%9B%AE%E5%8F%82%E5%8A%A0%E3%83%AC%E3%83%9D%E3%83%BC%E3%83%88-%E2%91%A0eos%E3%82%A8%E3%82%B3%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%81%A8eos%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9Fdapps%E3%81%AE%E4%BA%8B%E4%BE%8B%E7%B4%B9%E4%BB%8B-720164dec821?source=rss-1a88acf2ef9------2</link>
            <guid isPermaLink="false">https://medium.com/p/720164dec821</guid>
            <category><![CDATA[community]]></category>
            <dc:creator><![CDATA[Sasakky]]></dc:creator>
            <pubDate>Mon, 05 Nov 2018 10:24:26 GMT</pubDate>
            <atom:updated>2018-11-05T10:58:44.893Z</atom:updated>
            <content:encoded><![CDATA[<p>先日HashHubで開催された「EOS WeekEnd」の初日では、非開発者＆開発者向けにEOSの概要とエコシステムについて解説されました。当日は、60人ほどの参加者が集まり、懇親会も含め、大いに意見が飛び交い盛り上がりました。弊社平野のスピーチを除く３つの当日コンテンツについて、内容を紹介します。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQcE6xSjHxC5cD1a9rmgTA.jpeg" /></figure><p>最初はEOSリサーチャーとして、各種イベントやSteemitへの投稿など精力的に活動されている成田さん（@moromaro6）に、EOSエコシステムの概観とEOSを使ったDAppsの事例を紹介していただきました。</p><h3><strong>EOSエコシステムについて</strong></h3><p>・EOSはActivityの面で堂々のトップであり、二位のBTSと二倍以上の差をつけている。他のプラットフォームプロジェクト等に比べて、オンチェーン上ですべて処理しているものとしては実績がある。</p><p>・現在EOSプロジェクトとして表明しているものは257個くらい存在し、プロジェクトの種類は、Exchangeからゲームまで幅広く存在する。さらにプロジェクトの絶対数としても、特定の領域に偏っていない。これは、メインチェーンのローンチから３ヶ月の割には多い方ではないかと感じている。</p><p>・EOSプロジェクトはAirdropが盛んであり、大半は自分たちのプロジェクト認知を目的とする。まだまだこれからというプロジェクトも今現在動いているゲームなども含めて、全体的にAirdropでの認知獲得を図っている。</p><p>・EOSと細かいトークンがすぐに変換できるようなプラットフォームになっている。</p><p>・他のプラットフォームと比べてどのくらい違うのか<br>Total DApps数の割に、transactionの数・DAUの数が圧倒的に多い。具体的に上位に来ているものは、スピード感が求められるギャンブルゲームなどが多い印象。特に、素早く正確なトランザクションが必要なDappsは、EOSで作られがち。</p><p>・開発費用について<br>EOS開発は費用が初期開発に集約されており、ある程度最初に払っておけばそのあとは追加で支払うことはない。また、サービス終了時にはstakeしていたEOSトークンが戻ってくる。</p><h3><strong>DApps事例紹介</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQxxu3op3mLNbemrHOKM9g.png" /></figure><p>・Everipedia<br>EOS版Wikipedia。お金がかからない。投稿者の評価自体がオープンになっているので、より健全なwikipediaと言える。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7cSdsvlGKW0BT2ABPoOSAQ.png" /></figure><p>・EVA<br>分散型UBER</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ZqIbFzFFp9vq7RnOmkBrQ.png" /></figure><p>・ONO<br> EOS版Steemit。中国で活用されているSNSプラットフォーム。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hKvMGmPYO7ZgBxZ1DlxaTA.png" /></figure><p>・HireVibes<br>ジョブマッチングのプラットフォーム。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VUIfaKM8DmPYS_86GHrueg.png" /></figure><p>・Clemental Battles<br>EOS版クリプトゾンビ。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_ADDEw1F5HKQdINPaAbfA.png" /></figure><p>・ONEPAY<br>モバイル決済プラットフォーム。EOSは決済系には強い見通し。</p><p>以上となります。個人的には、EOSのDAppsは80個しか動いていないのに対して、一日のtransaction数は、2051個のDAppsを抱えるEthereumの約3倍近い量を誇っていることに驚きました。如何にEOSのトランザクションが高速であるかが伺えます。まだメインネットのローンチから三ヶ月ほどしか経っていないEOSですが、今後ますます多くのDAppsが開発されることが大いに期待されます。</p><p>当日の資料は下記からご覧いただけます。</p><p><a href="https://speakerdeck.com/moromaro/eos-uikuendo-fei-kai-fa-zhe-kai-fa-zhe-xiang-kegai-yao-toekosisutemu">https://speakerdeck.com/moromaro/eos-uikuendo-fei-kai-fa-zhe-kai-fa-zhe-xiang-kegai-yao-toekosisutemu</a></p><p>＊お知らせ</p><p>HashHubは、ブロックチェーン業界で働いている人のためのコワーキングスペースを運営しています。<br>ご利用希望者は、webサイトからお問い合わせください。 →<br><a href="https://hashhub.tokyo/">https://hashhub.tokyo/</a></p><p>現在、HashHubでは採用を行なっています。<br>・ コミュニティマネージャー<br>・ブロックチェーン技術者・開発者<br>・ビジネスディベロップメント<br>の3ポジションを募集しています。詳細はWantedlyのページをご覧ください。→<br><a href="https://www.wantedly.com/companies/hashhub/projects">https://www.wantedly.com/companies/hashhub/projects</a></p><p>HashHubに関する最新情報はTwitterをフォローして下さい。<br><a href="https://twitter.com/HashHub_Tokyo">https://twitter.com/HashHub_Tokyo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=720164dec821" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashhub/eos-weekend-%E4%B8%80%E6%97%A5%E7%9B%AE%E5%8F%82%E5%8A%A0%E3%83%AC%E3%83%9D%E3%83%BC%E3%83%88-%E2%91%A0eos%E3%82%A8%E3%82%B3%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%81%A8eos%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9Fdapps%E3%81%AE%E4%BA%8B%E4%BE%8B%E7%B4%B9%E4%BB%8B-720164dec821">EOS WeekEnd 一日目参加レポート ①EOSエコシステムとEOSを使ったDAppsの事例紹介</a> was originally published in <a href="https://medium.com/hashhub">HashHub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>