docstr: Query API: Test get queries updated since timestamp
docstr_tok: ["Query","API",":","Test","get","queries","updated","since","timestamp"]
code: def test_get_updated_since(self):
      """
      Query API: Test get queries updated since timestamp
      """
      now = datetime.utcnow()
      client_id = self.get_random_string()
  
      admin = self.get_user("admin")
      example_db = get_example_database()
  
      old_query = self.insert_query(
          example_db.id,
          admin.id,
          self.get_random_string(),
          sql="SELECT col1, col2 from table1",
          select_sql="SELECT col1, col2 from table1",
          executed_sql="SELECT col1, col2 from table1 LIMIT 100",
          changed_on=now - timedelta(days=3),
      )
      updated_query = self.insert_query(
          example_db.id,
          admin.id,
          client_id,
          sql="SELECT col1, col2 from table1",
          select_sql="SELECT col1, col2 from table1",
          executed_sql="SELECT col1, col2 from table1 LIMIT 100",
          changed_on=now - timedelta(days=1),
      )
  
      self.login(username="admin")
      timestamp = datetime.timestamp(now - timedelta(days=2)) * 1000
      uri = f"api/v1/query/updated_since?q={prison.dumps({'last_updated_ms': timestamp})}"
      rv = self.client.get(uri)
      self.assertEqual(rv.status_code, 200)
  
      expected_result = updated_query.to_dict()
      data = json.loads(rv.data.decode("utf-8"))
      self.assertEqual(len(data["result"]), 1)
      for key, value in data["result"][0].items():
          # We can't assert timestamp
          if key not in (
              "changed_on",
              "end_time",
              "start_running_time",
              "start_time",
              "id",
          ):
              self.assertEqual(value, expected_result[key])
      # rollback changes
      db.session.delete(old_query)
      db.session.delete(updated_query)
      db.session.commit()
  
imports: from datetime import datetime, timedelta
  from unittest import mock
  import json
  import random
  import string
  import pytest
  import prison
  from sqlalchemy.sql import func
  import tests.integration_tests.test_app
  from superset import db, security_manager
  from superset.common.db_query_status import QueryStatus
  from superset.models.core import Database
  from superset.utils.database import get_example_database, get_main_database
  from superset.models.sql_lab import Query
  from tests.integration_tests.base_tests import SupersetTestCase
label_desc: Use image node_id 14 for calling the TestQueryApi obj's underlying member method code with example usage: obj.test_get_updated_since() without return types