mariadb-load-data

Generates MariaDB-specific LOAD DATA INFILE and LOAD XML statements for bulk loading.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-load-data-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-load-data
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/statements/mariadb-load-data
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-load-data-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing LOAD DATA INFILE statements for MariaDB involves subtle traps: LOCAL vs server-side file access, privilege requirements, silent duplicate-key downgrades, disabled strict-mode aborts, and non-CSV defaults. This Skill provides the MariaDB-specific syntax and behavioral deltas so generated bulk-load statements work correctly the first time. ## Core Features & Use Cases - LOCAL vs server-side guidance: Explains the dual client/server enablement for LOCAL, the FILE privilege, and secure_file_priv constraints for server-side loads. - Trap avoidance: Documents how LOCAL silently downgrades duplicate handling to IGNORE, disables strict-mode aborts, and why defaults are tab/newline rather than CSV. - Full syntax coverage: Includes FIELDS/LINES clauses, IGNORE n LINES, user-variable plus SET transformations, CHARACTER SET, priority options, and the LOAD XML companion with ROWS IDENTIFIED BY. - Use Case: You need to bulk-load a CSV file with a header row into MariaDB and transform a date column on the fly. The Skill produces LOAD DATA LOCAL INFILE with FIELDS TERMINATED BY ',', IGNORE 1 LINES, and a SET clause using STR_TO_DATE on a user variable. ## Quick Start Ask the AI to write a MariaDB LOAD DATA statement that imports a CSV file with a header row into a table while converting a date column using a SET clause.

Frequently Asked Questions about mariadb-load-data

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I load a CSV file into a MariaDB table?▼

Use LOAD DATA INFILE with explicit CSV clauses, since MariaDB defaults to tab-separated fields and newline-terminated lines. Add FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' and IGNORE 1 LINES to skip a header row.

What is the difference between LOAD DATA LOCAL INFILE and LOAD DATA INFILE in MariaDB?▼

Without LOCAL, the MariaDB server reads the file from its own filesystem, requiring the FILE privilege and a path under secure_file_priv. With LOCAL, the client streams the file, but both the connector's local-infile option and the server's local_infile variable must be enabled.

Why does LOAD DATA LOCAL INFILE fail with local infile capability disabled?▼

LOCAL requires both ends enabled: the client or connector must allow local-infile, which is often off by default in drivers, and the server's local_infile system variable must be ON. Check both sides when you see this error.

Does LOAD DATA LOCAL INFILE honor REPLACE and strict mode in MariaDB?▼

No. With LOCAL, duplicate-key rows are silently treated as IGNORE and strict-mode abort-on-warning is disabled, so bad data is coerced with warnings instead of errors. Load from a server-side file for reliable REPLACE or error semantics, and check SHOW WARNINGS.

How do I transform column values during a LOAD DATA import?▼

Read the raw field into a user variable and transform it in the SET clause of the same statement, for example (id, @raw) SET created = STR_TO_DATE(@raw, '%m/%d/%Y'). This avoids a follow-up UPDATE pass.

Can LOAD DATA handle XML files in MariaDB?▼

Use the LOAD XML statement instead, which has no FIELDS/LINES clauses. It uses ROWS IDENTIFIED BY '<tag>' to name the row element, defaulting to <row>, and MariaDB auto-detects common attribute and element layouts.