Qovery / Replibyte

Seed your development database with real data ⚡️
https://www.replibyte.com
GNU General Public License v3.0
4.17k stars 129 forks source link

Transformers don't work with tables containing uppercase letters #174

Closed mkgharbi closed 2 years ago

mkgharbi commented 2 years ago

Hi

Transformers are not working correctly with tables containing uppercase characters (in my case a table named User). When I renamed the table to user, it worked perfectly. Is there a solution to make uppercase table names work on transformers ?

The conf.yaml file I used is:

source:
  connection_uri: $DATABASE_SOURCE_URL
  transformers:
    - database: public
      table: User
      columns:
        - name: name
          transformer_name: random
        - name: email
          transformer_name: email
datastore:
  aws:
    bucket: $BUCKET_NAME
    region: $S3_REGION
    credentials:
      access_key_id: $ACCESS_KEY_ID
      secret_access_key: $AWS_SECRET_ACCESS_KEY
destination:
  connection_uri: $DATABASE_DESTINATION_URL
evoxmusic commented 2 years ago

Can you give more details on which database do you use?

karpa4o4 commented 2 years ago

Hi @evoxmusic. I have tested and this problem is only in PostgreSQL. This is because PostgreSQL requires wrap table names in quotes if they contain uppercase characters. A simple solution to the problem is to wrap the table name in quotes (as in the screenshot), in which case I can reflect this behavior in the documentation. Screenshot_20220716_210613

karpa4o4 commented 2 years ago

A more complex solution is to implement automatic quotes when creating a dump for PostgreSQL.

mkgharbi commented 2 years ago

Thank you! It works perfectly! Keep the good work!

evoxmusic commented 2 years ago

Thank you @karpa4o4 - it will help to provide a fix

nilscam commented 2 years ago

Hi, it looks like columns names have the same issue :

The following doesn't work :

transformers:
    - database: public
       table: User
       columns:
          - name: pictureUrl
          ...

while the following works :

transformers:
    - database: public
       table: User
       columns:
          - name: '"pictureUrl"'
          ...
mirobertod commented 1 year ago

Hi, it looks like columns names have the same issue :

The following doesn't work :

transformers:
    - database: public
       table: User
       columns:
          - name: pictureUrl
          ...

while the following works :

transformers:
    - database: public
       table: User
       columns:
          - name: '"pictureUrl"'
          ...

same here