diff --git a/examples/experimental/otel_exporter.ipynb b/examples/experimental/otel_exporter.ipynb index f0a7a9941..1206b5cf4 100644 --- a/examples/experimental/otel_exporter.ipynb +++ b/examples/experimental/otel_exporter.ipynb @@ -60,29 +60,13 @@ "metadata": {}, "outputs": [], "source": [ - "import os\n", - "\n", "import dotenv\n", - "from trulens.connectors.snowflake import SnowflakeConnector\n", "from trulens.core.session import TruSession\n", "from trulens.experimental.otel_tracing.core.init import init\n", "\n", "dotenv.load_dotenv()\n", "\n", - "connection_params = {\n", - " \"account\": os.environ[\"SNOWFLAKE_ACCOUNT\"],\n", - " \"user\": os.environ[\"SNOWFLAKE_USER\"],\n", - " \"password\": os.environ[\"SNOWFLAKE_USER_PASSWORD\"],\n", - " \"database\": os.environ[\"SNOWFLAKE_DATABASE\"],\n", - " \"schema\": os.environ[\"SNOWFLAKE_SCHEMA\"],\n", - " \"warehouse\": os.environ[\"SNOWFLAKE_WAREHOUSE\"],\n", - " \"role\": os.environ[\"SNOWFLAKE_ROLE\"],\n", - "}\n", - "\n", - "connector = SnowflakeConnector(\n", - " **connection_params, database_redact_keys=True, database_args=None\n", - ")\n", - "session = TruSession(connector=connector)\n", + "session = TruSession()\n", "session.reset_database()\n", "init(session, debug=True)" ] diff --git a/src/core/trulens/core/database/sqlalchemy.py b/src/core/trulens/core/database/sqlalchemy.py index d604508de..de84616d6 100644 --- a/src/core/trulens/core/database/sqlalchemy.py +++ b/src/core/trulens/core/database/sqlalchemy.py @@ -25,15 +25,11 @@ import pandas as pd import pydantic from pydantic import Field -from snowflake.sqlalchemy import dialect as SnowflakeDialect import sqlalchemy as sa from sqlalchemy import Table -from sqlalchemy.ext.compiler import compiles from sqlalchemy.orm import joinedload from sqlalchemy.orm import sessionmaker from sqlalchemy.sql import text as sql_text -from sqlalchemy.sql.compiler import SQLCompiler -from sqlalchemy.sql.expression import Insert from trulens.core.database import base as core_db from trulens.core.database import exceptions as db_exceptions from trulens.core.database import migrations as db_migrations @@ -57,49 +53,6 @@ logger = logging.getLogger(__name__) -@compiles(Insert, SnowflakeDialect.name) -def patch_insert(statement: Insert, compiler: SQLCompiler, **kw): - """ - Patches INSERT SQL queries so sqlalchemy ORM will support Snowflake OBJECT. - - See: - * https://github.com/snowflakedb/snowflake-sqlalchemy/issues/299 - * https://github.com/snowflakedb/snowflake-sqlalchemy/issues/411 - - For more information (e.g. read about the parameters), please look at: - * https://docs.sqlalchemy.org/en/20/core/compiler.html - """ - insert_statement = compiler.visit_insert(statement, **kw) - - if statement.table.name.endswith("_events"): - insert_statement = insert_statement.replace( - "VALUES (%(record)s, %(event_id)s, %(record_attributes)s, %(record_type)s, %(resource_attributes)s, %(start_timestamp)s, %(timestamp)s, %(trace)s)", - """ -SELECT - PARSE_JSON(column1), - column2, - PARSE_JSON(column3), - column4, - PARSE_JSON(column5), - column6, - column7, - PARSE_JSON(column8), -from VALUES ( - %(record)s, - %(event_id)s, - %(record_attributes)s, - %(record_type)s, - %(resource_attributes)s, - %(start_timestamp)s, - %(timestamp)s, - %(trace)s -) -""", - ) - - return insert_statement - - class SnowflakeImpl(DefaultImpl): __dialect__ = "snowflake"