class_docstr: SQL connectors are used to connect to SQL databases in different dialects.
class_docstr_tok: ["SQL","connectors","are","used","to","connect","to","SQL","databases","in","different","dialects","."]
code: def _build_query(self, limit=None, order=None):
      base_query = select("*").select_from(text(self._config.table))
      if self._config.where or self._additional_filters:
          # conditions is the list of where + additional filters
          conditions = []
          if self._config.where:
              conditions += self._config.where
          if self._additional_filters:
              conditions += self._additional_filters
  
          query_params = {}
          condition_strings = []
  
          valid_operators = [
              "=",
              ">",
              "<",
              ">=",
              "<=",
              "LIKE",
              "!=",
              "IN",
              "NOT IN",
          ]
  
          for i, condition in enumerate(conditions):
              if len(condition) == 3:
                  column_name, operator, value = condition
                  if operator in valid_operators:
                      self._validate_column_name(column_name)
  
                      condition_strings.append(
                          f"{column_name} {operator} :value_{i}"
                      )
                      query_params[f"value_{i}"] = value
  
          if condition_strings:
              where_clause = " AND ".join(condition_strings)
              base_query = base_query.where(
                  text(where_clause).bindparams(**query_params)
              )
  
      if order:
          base_query = base_query.order_by(asc(text(order)))
  
      if limit:
          base_query = base_query.limit(limit)
  
      return base_query
  
imports: import re
  import os
  import pandas
  from pandasai.exceptions import MaliciousQueryError
  from .base import BaseConnector, SQLConnectorConfig, SqliteConnectorConfig
  from .base import BaseConnectorConfig
  from sqlalchemy import create_engine, text, select, asc
  from sqlalchemy.engine import Connection
  from functools import cached_property, cache
  import hashlib
  from ..helpers.path import find_project_root
  from ..constants import DEFAULT_FILE_PERMISSIONS
  from typing import Union
  import time
label_desc: Use image node_id 7 for calling the SQLConnector obj's underlying member method code with example usage: obj._build_query(limit, order) and returns: base_query