code: def __init__(
      self,
      ds,
      request,
      database,
      sql=None,
      table=None,
      params=None,
      metadata=None,
      row_count=None,
  ):
      assert table or sql, "Must provide either table= or sql="
      self.ds = ds
      self.request = request
      self.database = database
      # For foreign key expansion. Can be None for e.g. canned SQL queries:
      self.table = table
      self.sql = sql or f"select * from [{table}]"
      self.params = params or []
      self.metadata = metadata
      # row_count can be None, in which case we calculate it ourselves:
      self.row_count = row_count
  
file_path: datasette/datasette/facets.py
imports: import json
  import urllib
  from datasette import hookimpl
  from datasette.database import QueryInterrupted
  from datasette.utils import escape_sqlite, path_with_added_args, path_with_removed_args, detect_json1, sqlite3
label_desc: Use image node_id 1 to create a new Facet object  with example: obj = Facet(ds, request, database, sql, table, params, metadata, row_count)