LogoLogo
  • Preen
  • Getting Started
    • Installation
    • Hello World
      • Configuring Sources
      • Creating Models
  • Concepts
    • Overview
    • Sources
    • Models
    • Validation
  • Documentation
    • Config
      • Sources
      • Models
    • Integrations
      • Databases
        • Postgres
        • MySQL
        • MongoDB
      • Cloud Blob Storage
        • Amazon S3
      • File Formats
        • CSV
Powered by GitBook
On this page
  • Example Preen Source Configuration
  • MySQL Models
  • MySQL Type Mappings
  • Code References
  1. Documentation
  2. Integrations
  3. Databases

MySQL

how to configure preen to connect to MySQL databases.

PreviousPostgresNextMongoDB

Last updated 7 months ago

Preen uses the library to connect to MySQL databases.

Example Preen Source Configuration

# FILENAME: ~/.preen/sources.yaml
sources:
  - name: mysql-example
    engine: mysql
    connection:
      host: localhost
      port: 3306
      database: mysql
      username: ${MYSQL_USER} # You can specify environment variables in the sources.yaml file.
      password: ${MYSQL_PASSWORD}    

MySQL Models

MySQL models are defined as a YAML file that contains a SQL query.

# FILENAME: ~/.preen/models/users.yaml
name: users # This name needs to be unique
type: sql
query: |
  select
    users.id,
    users.first_name,
    users.last_name,
    users.birthday
  from
    users;

MySQL Type Mappings

Code References

A comprehensive list of MySQL type mappings can be found .

sql
here
types.go
postgres.go