visch
10/26/2022, 7:58 PMcreate_empty_table
(here https://github.com/meltano/sdk/blob/main/singer_sdk/connectors/sql.py#L565 ) being in the SQLConnector
make sense? My actual problem I'm trying to solve is I want access to the table metadata which is build as a SQLAlchmy MetaData object with SQL Alchemy columns, but for Values we don't have a good way of knowing which type this object is.
Actual actual (lol) issue I'm having
I"m having an issue inserting JSON data into a JSONB field in Postgres. I believe I have to wrap the value with the correct construct here https://docs.sqlalchemy.org/en/14/dialects/postgresql.html#postgresql-data-types-and-custom-sql-constructs to use the psycopg JSON extra psycopg2.extras.Json
here https://www.psycopg.org/docs/extras.html#json-adaptation
Not a big deal to force this to work for this instance but I'm trying to help with the general case here in the SDK.visch
10/26/2022, 8:05 PMvisch
10/26/2022, 8:20 PMedgar_ramirez_mondragon
10/26/2022, 8:41 PMBuzzCutNorman
10/26/2022, 8:52 PMfrom sqlalchemy import insert
def generate_insert_statement(
self,
full_table_name: str,
schema: dict,
) -> str:
"""Generate an insert statement for the given records.
Args:
full_table_name: the target table name.
schema: the JSON schema for the new table.
Returns:
An insert statement.
"""
statement = insert(self.connector.get_table(full_table_name))
return statement
BuzzCutNorman
10/26/2022, 8:53 PMfrom sqlalchemy.dialects.postgresql import insert