Open nmthangdn2000 opened 3 weeks ago
After logging the SQL query executed by the export command, I found that it used SELECT to retrieve all fields instead of using SELECT *. Unfortunately, this caused an error due to a column named "cast" in the movie table, which conflicted with the CAST function in SQL. I resolved the issue by renaming the column and successfully completed the export.
Thank you all for your interest!
Which Cloudflare product(s) does this pertain to?
D1
What version(s) of the tool(s) are you using?
3.60.3[wrangler]
What version of Node are you using?
20.14.0
What operating system and version are you using?
Mac sonoma 14.6.1
Describe the Bug
Hello, I am working with D1 and encountering an issue with exporting. I would greatly appreciate any help I can get.
My steps are as follows:
CREATE TABLE "Movie" ( "id" TEXT NOT NULL PRIMARY KEY, "idSource" INTEGER NOT NULL, "name" TEXT NOT NULL, "nameVi" TEXT NOT NULL, "totalViews" INTEGER NOT NULL, "monthlyViews" INTEGER NOT NULL, "genre" TEXT NOT NULL, "cast" TEXT NOT NULL, "director" TEXT NOT NULL, "country" TEXT NOT NULL, "year" INTEGER NOT NULL, "releaseDate" TEXT NOT NULL, "updateDate" TEXT NOT NULL, "cover" TEXT NOT NULL, "description" TEXT NOT NULL, "trailer" TEXT NOT NULL, "imdbRating" TEXT NOT NULL, "quality" TEXT NOT NULL, "episodesCount" INTEGER NOT NULL, "episodes" TEXT NOT NULL );
Command:
npx wrangler d1 execute movie-d1 --local --command="INSERT INTO movie (id, idSource, name, nameVi, totalViews, monthlyViews, genre, cast, director, country, year, releaseDate, updateDate, cover, description, trailer, imdbRating, quality, episodesCount, episodes) VALUES ('abc123', 1, 'Movie Title', 'Movie Title', 1000, 200, 'Action', 'Actor 1, Actor 2', 'Director Name', 'Country Name', 2024, '2024-01-01', '2024-01-01', 'http://example.com/cover.jpg', 'Description of the movie', 'http://example.com/trailer.mp4', 8.5, 'HD', 10, 'Episode 1, Episode 2');"
Command
npx wrangler d1 export movie-d1 --local --output=./database.sql
The error I encountered is quite challenging, making it difficult for me to test and resolve the issues. I would sincerely appreciate any assistance you can provide. Thank you!
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
--- 2024-10-31T08:36:49.764Z debug ๐ชต Writing logs to "/Users/vacs-imac/Library/Preferences/.wrangler/logs/wrangler-2024-10-31_08-36-48_939.log"
--- 2024-10-31T08:36:49.764Z log
โ ๏ธ wrangler 3.83.0 (update available [32m3.84.0[39m) [38;2;255;136;0m-------------------------------------------------------[39m
--- 2024-10-31T08:36:49.765Z debug No experimental flag store instantiated
--- 2024-10-31T08:36:49.765Z debug Attempted to use flag "JSON_CONFIG_FILE" which has not been instantiated
--- 2024-10-31T08:36:49.770Z log ๐ Exporting local database movie-d1 (844d6930-e482-4c23-897c-1f74e7194604) from .wrangler/state/v3/d1:
--- 2024-10-31T08:36:49.770Z log ๐ To export your remote database, add a --remote flag to your wrangler command.
--- 2024-10-31T08:36:50.122Z log ๐ Exporting SQL to ./database.sql...
--- 2024-10-31T08:36:50.192Z log