{"id":17149,"date":"2022-09-23T07:59:28","date_gmt":"2022-09-23T11:59:28","guid":{"rendered":"https:\/\/qxf2.com\/blog\/?p=17149"},"modified":"2022-09-23T07:59:28","modified_gmt":"2022-09-23T11:59:28","slug":"metric-store-evaluation-parameters-great-expectations","status":"publish","type":"post","link":"https:\/\/qxf2.com\/blog\/metric-store-evaluation-parameters-great-expectations\/","title":{"rendered":"Tracking table row count using Metric Store of Great Expectations"},"content":{"rendered":"<p>In this blog post, we will explore the metric store and evaluation parameters feature of Great Expectations. These help us track data about our data collection. I will help you write a test to keep track of table row count using <a href=\"https:\/\/docs.greatexpectations.io\/docs\/\" rel=\"noopener\" target=\"_blank\">Great Expectations<\/a>. This post is fifth in our series to help testers implement useful tests with Great Expectations for data validation. Read on to understand how keeping track of a simple yet useful test like daily row count of a table provides valuable insights for further analysis. <\/p>\n<h5>Notes:<\/h5>\n<p>1. This post requires familiarity with Great Expectations. If you are new to this, do check out my previous blog posts. I have covered the basics of using this framework in detail.<br \/>\n2. To show the table row count test, I will be using the same real-world scenario use case described in my first blog post &#8211; <a href=\"https:\/\/qxf2.com\/blog\/data-validation-great-expectations-real-example\/\">Data validation using Great Expectations using real example<\/a>. The data file required is <a href=\"https:\/\/gist.github.com\/sravantit25\/bbbf30ef4a0a0d9de3957d1a563d4a62\">here<\/a>. Ensure that you are setup with a Great Expectations deployment and have a FileBased Datasource that can read the CSV.<br \/>\n3. For the storage backend, I am going to use Postgres SQL database that I have setup locally. You can apply it to any other SQL database supported by Great Expectations.  <\/p>\n<hr>\n<h3>Context<\/h3>\n<p>Looking at trends in data about the data collected (i.e. metadata) is often an intuitive heuristic for testers to spot problems in data collection. For example, if you collect data from external sources everyday as part of your MLOps or DataOps lifecycle, you are bound to have faced problems with incomplete data or partially collected data. This can happen due to many reasons like the data source API changing, the format of the data being collected changing, modified identifiers in the case of scraping, etc. As testers, we know something went wrong, because we ended up collecting lesser (or no) data that day. Tracking metadata about the data collected and then checking them for a range ends up being a super-useful check to have in place. In this post, I will show you how to implement one of these checks using Great Expectations.<\/p>\n<hr>\n<h3>If you are planning on implementing such tests &#8230;<\/h3>\n<p>To implement similar checks on metadata in your project, you should think of the following:<br \/>\na) Metadata you want to track (e.g.: collection times, row count, etc.)<br \/>\nb) Condition\/trend you want to check for (e.g.: within a certain range, exactly equal to yesterday, less on weekend, etc.)<br \/>\nc) Batch of data you want step b) working upon (e.g.: monthly metadata, daily metadata, etc.) <\/p>\n<p>I have tried to make step b) and c) trivial in my example so you can play along easily with this post. For the condition, I choose exactly equal to previous and for the batch of metadata, I choose daily data. <\/p>\n<h3>About the example test<\/h3>\n<p>At <a href=\"https:\/\/qxf2.com\/?utm_source=ge_using_metric_store&#038;utm_medium=click&#038;utm_campaign=From%20blog\">Qxf2<\/a>, I have been writing data quality tests using Great Expectations for one of the projects. To give a bit of context, the portion of the project that I work on keeps track of data related to all the open-sourced GitHub repositories under Qxf2. As I worked on implementing and adding more tests to it, I reflected upon the importance of having tests around metadata. To being with, I put up a test for checking table row count. In this blog, I will show how to implement it using Great Expectations and later look at how to perform some analysis with the results.<\/p>\n<p>To start with, I picked a simple use case of sending a notification whenever a new repo gets added under Qxf2. For this, I put up a test to check number of rows of table which has the list of all the GitHub repos names under Qxf2. The test would compare the row count of current run with the previous one. When there is a difference, it would fail. Which would send out the notification. Over time gathering such metrics or metadata would help to provide valuable insights into data trends. To capture dynamic results as they are generated, I utilized <a href=\"https:\/\/docs.greatexpectations.io\/docs\/terms\/metric_store\/\">Metric Store<\/a> and <a href=\"https:\/\/docs.greatexpectations.io\/docs\/reference\/evaluation_parameters\/\">Evaluation Parameters<\/a>, a feature of Great Expectations which can help to store and use metrics. I felt it will be useful to go over it in detail in a blog post. Let us look at the steps in detail.<\/p>\n<hr>\n<h3>Breakdown<\/h3>\n<p>We will be doing the following steps:<\/p>\n<ol>\n1. Capture the validation results from previous Expectation run<\/p>\n<ol>\n    1.1 Write table row count test<br \/>\n    1.2 Setup Metric Store to store results from validation run<br \/>\n    1.3 Verify that values are getting stored in the database\n<\/ol>\n<p>2. Compare the results between different runs<\/p>\n<ol>2.1 Query the database to fetch the required value<br \/>\n    2.2 Define Evaluation Parameters to store the dynamically fetched value<br \/>\n    2.3 Update the table row count test to use the Evaluation Parameter\n<\/ol>\n<p>3. Perform analysis using the results\n<\/ol>\n<hr>\n<h3>Detailed Steps<\/h3>\n<p>Let us get into the technical implementation of each of them:<\/p>\n<h4>1. Capture the validation results from previous Expectation run<\/h4>\n<p>In this section, we will first write the test to check the total number of rows of github_substreams table. This is the table which consists of all the GitHub repositories under Qxf2. To store the results, we will configure a Metric Store. As the name suggests, a <a href=\"https:\/\/docs.greatexpectations.io\/docs\/terms\/metric_store\/\">Metric Store<\/a> is used to store and retrieve Metrics which are computed attributes or data about data. Saving such information which is computed during validation runs will help in performing analysis later. Finally, we will verify if the data is getting stored in the database.<\/p>\n<h5>1.1 Write table row count test<\/h5>\n<p>Skip this section if you already have a test that checks table row count. I have created a new Expectation Suite for this test. You could always use an existing one. Add a table level expectation. The one we want is &#8216;<a href=\"https:\/\/greatexpectations.io\/expectations\/expect_table_row_count_to_equal\" rel=\"noopener\" target=\"_blank\">expect_table_row_count_to_equal<\/a>&#8216;. For this first run, I will compare it with the actual number of rows in the table which I know is 55.<\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/run_table_exp.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/run_table_exp.png\" alt=\"This screenshot shows the initial run of table row count expectation\" width=\"701\" height=\"313\" class=\"size-full wp-image-17150\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/run_table_exp.png 701w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/run_table_exp-300x134.png 300w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/a><\/p>\n<p>Here, we can see that the number of rows in the table result is getting saved into observed_value. We will store this value as metric and later use for comparison. <\/p>\n<p>Further, I have created a checkpoint to run the above expectation suite. We will be adding the metric there. <\/p>\n<h5>1.2 Setup Metric Store to store results from validation run<\/h5>\n<p>We will now configure a Metric Store which will track details such as run_id, Expectation Suite name and other specific requested values. All these are stored in a table called ge_metrics which gets created during the first run. To setup Metric Store, we would need to perform the following steps:<\/p>\n<h5>i) Add a MetricStore store to our Data Context<\/h5>\n<p>The config information of our Great Expectations deployment resides in the great_expectations.yml file. So, we will add our new store here. Go the stores section of the file and add the following code. We need to provide two required keys &#8211; the class_name which must be MetricStore and the store_backend which is DatabaseStorageBackend since we are using DB as storage.<\/p>\n<pre lang=\"python\">\r\nmetric_store:\r\n  class_name: MetricStore\r\n  store_backend:\r\n    class_name: DatabaseStoreBackend\r\n    credentials: ${qelo_postgres_db_creds}\r\n<\/pre>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/code_snippet_for_metric_store.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/code_snippet_for_metric_store.png\" alt=\"This screenshot shows how to add metric store to great_expectations.yml file\" width=\"643\" height=\"239\" class=\"size-full wp-image-17151\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/code_snippet_for_metric_store.png 643w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/code_snippet_for_metric_store-300x112.png 300w\" sizes=\"auto, (max-width: 643px) 100vw, 643px\" \/><\/a><\/p>\n<p>We can save the credentials inline or use the config_varaiables.yml file present under uncommitted folder (by default provided by Great Expectations). I placed the credentials in the yml file temporarily for local setup. The following information is required, update it according to your values.<\/p>\n<pre lang=\"python\">\r\nqelo_postgres_db_creds:\r\n  username: postgres # default username provided by postgres\r\n  password: <your_password>\r\n  port: 5432  # default port used by postgres\r\n  host: localhost\r\n  database: qelo  # the database I created for this project\r\n  drivername: postgresql\r\n<\/pre>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_cred.png\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_cred.png\" alt=\"This screenshot shows the postgres database credentials stored in config_variables.yml file\" width=\"450\" height=\"207\" class=\"alignnone size-full wp-image-17196\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_cred.png 450w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_cred-300x138.png 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<h5>ii) Add an Action to the Checkpoint to define the Metrics<\/h5>\n<p>Edit the Checkpoint which is used for running the row count test to add a new Action. We will use StoreMetricsAction action type which will help in saving Metrics during validation. To define the action, provide the following:<\/p>\n<p>* class_name &#8211; must be StoreMetricsAction<br \/>\n* target_store_name &#8211; specify the backend for storing metrics. We have already defined the backend in earlier step while adding the MetricStore. Provide the same key name here. In our case, it is metric_store.<br \/>\n* requested_metrics &#8211; provide details regarding the Expectation Suite and the corresponding Metrics we want to store. <\/p>\n<pre lang=\"python\">\r\n- name: store_metrics\r\n  action:\r\n    class_name: StoreMetricsAction\r\n    target_store_name: metric_store\r\n    requested_metrics:\r\n      github_repos_tracker_suite:\r\n        - expect_table_row_count_to_equal.result.observed_value\r\n<\/pre>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_action_list.png\" data-rel=\"lightbox-image-3\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_action_list.png\" alt=\"This screenshot shows the store_metrics action that needs to be added to Checkpoint\" width=\"527\" height=\"359\" class=\"alignnone size-full wp-image-17153\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_action_list.png 527w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_action_list-300x204.png 300w\" sizes=\"auto, (max-width: 527px) 100vw, 527px\" \/><\/a><\/p>\n<h5>1.3 Run the checkpoint<\/h5>\n<p>To see the changes we made, let us run the checkpoint. Make sure to install sqlalchemy and psycopg2. <\/p>\n<p>I used the CLI command:<br \/>\n<code>great_expectations checkpoint run github_repos_tracker_checkpoint <\/code><br \/>\nRun the steps in the Jupyter noteboook. It will initialize the Data Context and run the Expectation Suite having the table row count test. <\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_run.png\" data-rel=\"lightbox-image-4\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_run.png\" alt=\"This screenshot shows the checkpoint run\" width=\"650\" height=\"73\" class=\"alignnone size-full wp-image-17202\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_run.png 650w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/checkpoint_run-300x34.png 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/a><\/p>\n<p>Next, let us check the database to see if the requested metrics have been added.<\/p>\n<h5>1.4 Verify Metrics are stored in the database<\/h5>\n<p>As noted earlier, for storing the metrics I used Postgres. For this project, I created a database called qelo. Using the psql shell, I logged in and connected to the database. And then ran a query to see the tables that are present:<\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_ge_metrics_table.png\" data-rel=\"lightbox-image-5\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_ge_metrics_table.png\" alt=\"This screenshot shows the list of tables in postgres db\" width=\"420\" height=\"132\" class=\"alignnone size-full wp-image-17197\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_ge_metrics_table.png 420w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_ge_metrics_table-300x94.png 300w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/a><\/p>\n<p>We see that a table with name ge_metrics is present. This is the one that gets created whenever Checkpoint with Metrics is run. Next, we will perform a query to fetch the data from the table. To run queries, I used pgAdmin tool. Open the Query Tool present under Tools<\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_db.png\" data-rel=\"lightbox-image-6\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_db.png\" alt=\"This screenshot shows the pgAdmin tool with the Query editor opened\" width=\"598\" height=\"318\" class=\"alignnone size-full wp-image-17155\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_db.png 598w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/postgres_db-300x160.png 300w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<p>Run the query <code> select * from public.ge_metrics; <\/code><\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/ge_metrics_data_captured.png\" data-rel=\"lightbox-image-7\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/ge_metrics_data_captured.png\" alt=\"This screenshot shows the select query to retrieve records from ge_metrics table\" width=\"1100\" height=\"250\" class=\"alignnone size-full wp-image-17156\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/ge_metrics_data_captured.png 1100w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/ge_metrics_data_captured-300x68.png 300w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/ge_metrics_data_captured-1024x233.png 1024w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/ge_metrics_data_captured-768x175.png 768w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/a><\/p>\n<p>We see that a row has been created with results of our earlier checkpoint run. The result of &#8220;expect_table_row_count_to_equal.result.observed_value&#8221; metric we defined in the checkpoint, is getting stored in the &#8220;value&#8221; column. In the next section, we will see how to retrieve and use that value.<\/p>\n<hr>\n<h4>2. Compare the results between different runs<\/h4>\n<p>So far we have captured the information that is required, let us now see how we can use that in our test. We will use <a href=\"https:\/\/docs.greatexpectations.io\/docs\/reference\/evaluation_parameters\/\" rel=\"noopener\" target=\"_blank\">Evaluation Parameters<\/a> which will help in enabling us to use dynamic values in Expectations. In our case, we want the table row count of previous run which has been stored in the ge_metrics table of postgres database. So, we will write a query to fetch the latest value dynamically(for every run). <\/p>\n<h5>2.1 Query the database to fetch the required value<\/h5>\n<p>First, we will frame the query to fetch the required value from the database. We want the most recent value present in the column &#8220;value&#8221;. This is stored in the format of {&#8220;value&#8221;:55}. So, once we fetch the value, we will further extract the number by using value::json->>&#8217;value&#8217;. The complete postgres query would be:<\/p>\n<pre lang=\"python\">\r\nSELECT (value::json->>'value')::int as value FROM public.ge_metrics where metric_name = 'expect_table_row_count_to_equal.result.observed_value' order by run_time desc limit 1\r\n<\/pre>\n<p>Next, we will be using this query while defining Evaluation Parameters.<\/p>\n<h5>2.2 Define the Evaluation Parameters to store the dynamically fetched value<\/h5>\n<p>Similar to what we have done earlier while adding Metric Store, we will edit the great_expectations.yml file to add another store. This will be an SQlAlchemy Query store that will query the connected database and return the result of the query as an Evaluation Parameter.<\/p>\n<p>Go to the stores section and add the below configuration.<\/p>\n<pre lang=\"python\">\r\nge_table_metric_store:  # store name can be anything\r\n  class_name: SqlAlchemyQueryStore  \r\n  credentials: ${qelo_postgres_db_creds} # the creds we had stored earlier\r\n  queries:\r\n    substream_value:  # evaluation parameter name\r\n      query: \"SELECT (value::json->>'value')::int as value FROM public.ge_metrics where metric_name = 'expect_table_row_count_to_equal.result.observed_value' order by run_time desc limit 1\"\r\n      return_type: \"scalar\" # this is necessary, else it will default to list\r\n<\/pre>\n<p>Next, let us update the Expectation with the this Evaluation Parameter.<\/p>\n<h5>2.3 Update the table row count test to use the Evaluation Parameter<\/h5>\n<p>In our table row count test, we will now update the hard-coded value which we used initially with the above Evaluation Parameter. To refer to it, we need to use the following<br \/>\nformat. It is a store-style URN starting with urn:great_expectations:stores. This is followed by store name and finally the name of the parameter we defined above.<\/p>\n<p><strong>&#8220;$PARAMETER&#8221;: &#8220;urn:great_expectations:stores:ge_table_metric_store:substream_value&#8221;<\/strong><\/p>\n<p>The updated test will look like:<\/p>\n<pre lang=\"python\">\r\nvalidator.expect_table_row_count_to_equal(\r\n    value={\"$PARAMETER\": \"urn:great_expectations:stores:ge_table_metric_store:substream_value\"}\r\n)\r\n<\/pre>\n<p>Now, whenever this expectation will run, it will compare the current value with the value of the previous run (dynamically stored in substream_value Evaluation Parameter).<\/p>\n<p><a href=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/final_exp_result.png\" data-rel=\"lightbox-image-8\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/final_exp_result.png\" alt=\"This screenshot shows the table row count test run when comparing results between different runs\" width=\"800\" height=\"371\" class=\"alignnone size-full wp-image-17189\" srcset=\"https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/final_exp_result.png 800w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/final_exp_result-300x139.png 300w, https:\/\/qxf2.com\/blog\/wp-content\/uploads\/2022\/08\/final_exp_result-768x356.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>We are now set with using dynamic results in our Great Expectations test. <\/p>\n<hr>\n<h3>Other use cases of tracking row count test<\/h3>\n<p>Depending on the scale and nature of a project, there can be various ways we can utilize the table row count results. In my case, I used it to send a notification whenever there is an increase or decrease in the number of repos. Taking another example, if I am working with a scraper, I might want to make sure that I get ~ X +- 50% new rows of data every day. So keeping track of daily row count helps. Another generic case can be, for instance, a scenario where a retail business keeps track of the number of customers that come to their store on a daily basis. Tracking this data over time will help the business design appropriate strategies to attract customers and have an edge over their competitors. <\/p>\n<hr>\n<h3>Next Steps<\/h3>\n<p>I plan to explore the concept of batching especially for big data sets. I am eager to try them out and produce something which would hopefully be useful to the testing community as well. Stay tuned for more blog posts in this series. Thanks for reading!<\/p>\n<hr>\n<h3>References<\/h3>\n<p>1. <a href=\"https:\/\/docs.greatexpectations.io\/docs\/guides\/setup\/configuring_metadata_stores\/how_to_configure_a_metricsstore\/\" rel=\"noopener\" target=\"_blank\">https:\/\/docs.greatexpectations.io\/docs\/guides\/setup\/configuring_metadata_stores\/how_to_configure_a_metricsstore\/<\/a><br \/>\n2. <a href=\"https:\/\/docs.greatexpectations.io\/docs\/guides\/expectations\/advanced\/how_to_dynamically_load_evaluation_parameters_from_a_database\/\" rel=\"noopener\" target=\"_blank\">https:\/\/docs.greatexpectations.io\/docs\/guides\/expectations\/advanced\/how_to_dynamically_load_evaluation_parameters_from_a_database\/<\/a><br \/>\n3. <a href=\"https:\/\/phoenixnap.com\/kb\/install-postgresql-windows\" rel=\"noopener\" target=\"_blank\">https:\/\/phoenixnap.com\/kb\/install-postgresql-windows<\/a><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, we will explore the metric store and evaluation parameters feature of Great Expectations. These help us track data about our data collection. I will help you write a test to keep track of table row count using Great Expectations. This post is fifth in our series to help testers implement useful tests with Great Expectations for [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[314,313],"tags":[],"class_list":["post-17149","post","type-post","status-publish","format-standard","hentry","category-data-testing","category-great-expectations"],"_links":{"self":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/17149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/comments?post=17149"}],"version-history":[{"count":18,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/17149\/revisions"}],"predecessor-version":[{"id":17224,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/posts\/17149\/revisions\/17224"}],"wp:attachment":[{"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/media?parent=17149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/categories?post=17149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qxf2.com\/blog\/wp-json\/wp\/v2\/tags?post=17149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}