code: def test_df_to_sql_if_exists_fail_with_schema(mock_g):
      mock_g.user = True
      mock_database = mock.MagicMock()
      mock_database.get_df.return_value.empty = False
      with pytest.raises(
          SupersetException, match="Table already exists"
      ):
          HiveEngineSpec.df_to_sql(
              mock_database,
              Table(table="foobar", schema="schema"),
              pd.DataFrame(),
              {"if_exists": "fail"},
          )
  
imports: from unittest import mock
  import pytest
  import pandas
  from sqlalchemy.sql import select
  from superset.db_engine_specs.hive import HiveEngineSpec, upload_to_s3
  from superset.exceptions import SupersetException
  from superset.sql_parse import Table, ParsedQuery
  from tests.integration_tests.test_app import app
label_desc: Use image node_id 12 for calling a global function with example usage: test_df_to_sql_if_exists_fail_with_schema(mock_g) without return types