pyspark-ai
pyspark-ai copied to clipboard
Table name as parameter for function create_df()
Hi,
could you add a parameter "tablename" for the function create_df()? In same cases a table with an automaticlly detected name cannot be created, but the SQL works with different table name:
Spark AI call:
Debug output:
INFO: Parsing URL: https://www.procontra-online.de/sach-privat/artikel/softfair-ermittelt-die-besten-wohngebaeude-tarife
INFO: SQL query for the ingestion:
CREATE OR REPLACE TEMP VIEW wohngebäude_tarife AS
SELECT 'Alte Leipziger' AS Versicherer, 'comfort mit Baustein Haus- und Wohnungsschutzbrief' AS Tarifkombination, 5275 AS Punktzahl
UNION ALL
SELECT 'Janitos' AS Versicherer, 'Best Selection mit Bausteinen Allgefahrendeckung, Hausschutzbrief und Multi-Garantie' AS Tarifkombination, 5275 AS Punktzahl
UNION ALL
SELECT 'Dema' AS Versicherer, 'Immo Protect Top mit Baustein Unbenannte Gefahren/ Marktgarantie' AS Tarifkombination, 5225 AS Punktzahl
UNION ALL
SELECT 'Domcura' AS Versicherer, 'Top mit Baustein Unbenannte Gefahren/ Marktgarantie' AS Tarifkombination, 5225 AS Punktzahl
UNION ALL
SELECT 'Adcuri' AS Versicherer, 'Premium mit Bausteinen Elektronik & Haustechnik, Unbenannte Gefahren' AS Tarifkombination, 5200 AS Punktzahl
UNION ALL
SELECT 'Manufaktur Augsburg' AS Versicherer, 'Premium Plus mit Bausteinen Smart Home, Unbenannte Gefahren/Marktgarantie' AS Tarifkombination, 5125 AS Punktzahl
UNION ALL
SELECT 'Axa' AS Versicherer, 'Komfort mit Bausteinen Optimum, Premium' AS Tarifkombination, 5075 AS Punktzahl
UNION ALL
SELECT 'Grundeigentümer Versicherung' AS Versicherer, 'ProtectPremium mit Baustein Soforthilfe' AS Tarifkombination, 5030 AS Punktzahl
UNION ALL
SELECT 'Rhion' AS Versicherer, 'Premium mit Baustein Best-Leistungs-Garantie' AS Tarifkombination, 4975 AS Punktzahl
UNION ALL
SELECT 'Konzept & Marketing' AS Versicherer, 'Allsafe Domo' AS Tarifkombination, 4830 AS Punktzahl
INFO: Storing data into temp view: wohngebäude_tarife
Spark Parse Exception:
[PARSE_SYNTAX_ERROR] Syntax error at or near 'ä'.(line 1, pos 35)
== SQL ==
CREATE OR REPLACE TEMP VIEW wohngebäude_tarife AS
...
@neox2811 Thanks for the input. Yes, this makes sense. We will support customized temp view names.
@neox2811 this should be fixed in https://github.com/databrickslabs/pyspark-ai/pull/80 I verified with:
spark_ai.create_df("https://www.procontra-online.de/sach-privat/artikel/softfair-ermittelt-die-besten-wohngebaeude-tarife")
output:
CREATE OR REPLACE TEMP VIEW temp_view_8cf30c AS
SELECT * FROM VALUES
('Alte Leipziger', 'comfort mit Baustein Haus- und Wohnungsschutzbrief', 5275),
('Janitos', 'Best Selection mit Bausteinen Allgefahrendeckung, Hausschutzbrief und Multi-Garantie', 5275),
('Dema', 'Immo Protect Top mit Baustein Unbenannte Gefahren/ Marktgarantie', 5225),
('Domcura', 'Top mit Baustein Unbenannte Gefahren/ Marktgarantie', 5225),
('Adcuri', 'Premium mit Bausteinen Elektronik & Haustechnik, Unbenannte Gefahren', 5200),
('Manufaktur Augsburg', 'Premium Plus mit Bausteinen Smart Home, Unbenannte Gefahren/Marktgarantie', 5125),
('Axa', 'Komfort mit Bausteinen Optimum, Premium', 5075),
('Grundeigentümer Versicherung', 'ProtectPremium mit Baustein Soforthilfe', 5030),
('Rhion', 'Premium mit Baustein Best-Leistungs-Garantie', 4975),
('Konzept & Marketing', 'Allsafe Domo', 4830)
AS v1(insurer, tariff, score)