Skip to content

Commit

Permalink
test(python): create table from pandas df (#2488)
Browse files Browse the repository at this point in the history
  • Loading branch information
greyscaled authored and tychoish committed Feb 1, 2024
1 parent 3e35218 commit 65950f9
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions bindings/python/tests/test_pandas.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import glaredb
import pandas as pd
import pytest


def test_sql():
Expand Down Expand Up @@ -115,3 +116,44 @@ def test_execute():

assert out.equals(expected)
con.close()

@pytest.mark.skip(reason="See Issue #2487")
def test_create_table_from_dataframe():
con = glaredb.connect()

df = pd.DataFrame(
{
"fruits": ["banana"],
}
)
expected = pd.DataFrame(
{
"fruits": ["banana"],
}
)

con.execute("CREATE TABLE test_table AS SELECT * FROM df;")
out = con.execute("SELECT * FROM test_table;").to_pandas()
assert out.equals(expected)

con.close()

def test_create_temp_table_from_dataframe():
con = glaredb.connect()

df = pd.DataFrame(
{
"fruits": ["banana"],
}
)
expected = pd.DataFrame(
{
"fruits": ["banana"],
}
)

con.execute("CREATE TEMP TABLE test_temp_table AS SELECT * FROM df;")
out = con.execute("SELECT * FROM test_temp_table;").to_pandas()
assert out.equals(expected)

con.close()

0 comments on commit 65950f9

Please sign in to comment.