Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEMP TABLE does not exist when inserting into an Iceberg table #30

Open
ryanwithawhy opened this issue Feb 20, 2025 · 1 comment
Open
Assignees

Comments

@ryanwithawhy
Copy link
Collaborator

Run the following code in Snowflake directly:

CREATE OR REPLACE ICEBERG TABLE universql_demo.gold.finwire_cmp (
    PTS TIMESTAMP NOT NULL,
    CompanyName STRING NOT NULL,
    CIK STRING NOT NULL,
    Status STRING NOT NULL,
    IndustryID STRING NOT NULL,
    SPRating STRING,
    FoundingDate DATE,
    AddrLine1 STRING NOT NULL,
    AddrLine2 STRING,
    PostalCode STRING NOT NULL,
    City STRING NOT NULL,
    StateProvince STRING NOT NULL,
    Country STRING,
    CEOName STRING NOT NULL,
    Description STRING NOT NULL
)
EXTERNAL_VOLUME = ICEBERG_EXTERNAL_VOLUME
CATALOG = 'SNOWFLAKE'
BASE_LOCATION = 'tables';

Then connect to your instance via UniverSQL and run this code:

CREATE OR REPLACE TEMPORARY TABLE silver_finwire_cmp (
    PTS TIMESTAMP NOT NULL,
    CompanyName VARCHAR(60) NOT NULL,
    CIK VARCHAR(10) NOT NULL,
    Status CHAR(4) NOT NULL,
    IndustryID CHAR(2) NOT NULL,
    SPRating CHAR(4),
    FoundingDate DATE,
    AddrLine1 VARCHAR(80) NOT NULL,
    AddrLine2 VARCHAR(80),
    PostalCode VARCHAR(12) NOT NULL,
    City VARCHAR(25) NOT NULL,
    StateProvince VARCHAR(20) NOT NULL,
    Country VARCHAR(24),
    CEOName VARCHAR(46) NOT NULL,
    Description VARCHAR(150) NOT NULL
);

SELECT * FROM universql_demo.gold.finwire_cmp;

INSERT INTO universql_demo.gold.finwire_cmp
SELECT *
FROM silver_finwire_cmp;

The create temp table statement and select from temp table statements succeed. However, the insert statement fails with the following error:

SQL Error [42S02]: 01ba84e2-010c-5c92-0048-cd8700688016: 002003 (42S02): SQL compilation error:
Object 'SILVER_FINWIRE_CMP' does not exist or not authorized. 
INSERT INTO universql_demo.gold.finwire_cmp
SELECT
  *
FROM silver_finwire_cmp
@buremba buremba self-assigned this Feb 21, 2025
@buremba
Copy link
Owner

buremba commented Feb 22, 2025

So here is a query it executed:

CREATE OR REPLACE VIEW universql_demo.gold.finwire_cmp AS SELECT * FROM ICEBERG_SCAN('s3://universql-us-east-1/universql_demo.gold.finwire_cmp/metadata/00000-bb6ca3a2-ed72-4c10-9f26-dc6609948db7.metadata.json')

Unfortunately, DuckDB returns IOException('IO Error: No snapshots found') error if the metadata doesn't have any snapshots. As a workflow, we can use AS SELECT .
I created an issue in Iceberg repo: duckdb/duckdb-iceberg#108

We probably need to switch to catalog support once the extension supports INSERT/CREATE/MERGE duckdb/duckdb-iceberg#98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants