pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Rémi Cura <remi.cura@gmail.com>
To: PostgreSQL General <pgsql-general@postgresql.org>
Subject: Re: automated 'discovery' of a table : potential primary key, columns functional dependencies ...
Date: Fri, 22 Nov 2019 14:48:50 -0800
Message-ID: <80d60035-6c4a-4eac-df16-956fc49901e8@aklaver.com> (raw)
In-Reply-To: <CAJvUf_vLNn51OdhDDF94VwxmCyEiQDn3LwuumMY6sGsP7muc=Q@mail.gmail.com>
References: <CAJvUf_vLNn51OdhDDF94VwxmCyEiQDn3LwuumMY6sGsP7muc=Q@mail.gmail.com>

On 11/22/19 2:05 PM, Rémi Cura wrote:
> Hello dear List,
> I'm currently wondering about how to streamline the normalization of a 
> new table.
> 
> I often have to import messy CSV files into the database, and making 
> clean normalized version of these takes me a lot of time (think dozens 
> of columns and millions of rows).

To me messy means the information to do the below is not available. 
Personally I think you best bet is to get the data into tables and then 
use visualization tools to help you determine the below. My guess is 
there will be a lot of data cleaning going on before you can get to a 
well ordered table layout.

> 
> I wrote some code to automatically import a CSV file and infer the type 
> of each column.
> Now I'd like to quickly get an idea of
>   - what would be the most likely primary key
>   - what are the functional dependencies between the columns
> 
> The goal is **not** to automate the modelling process,
> but rather to automate the tedious phase of information collection
> that is necessary for the DBA to make a good model.
> 
> If this goes well, I'd like to automate further tedious stuff (like 
> splitting a table into several ones with appropriate foreign keys / 
> constraints)
> 
> I'd be glad to have some feedback / pointers to tools in plpgsql or even 
> plpython.
> 
> Thank you very much
> Remi
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (2+ messages)

Message-ID: <80d60035-6c4a-4eac-df16-956fc49901e8@aklaver.com>
Permalink:  ../80d60035-6c4a-4eac-df16-956fc49901e8@aklaver.com/
Also on:    postgresql.org/message-id/80d60035-6c4a-4eac-df16-956fc49901e8@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, remi.cura@gmail.com
  Subject: Re: automated 'discovery' of a table : potential primary key, columns functional dependencies ...
  In-Reply-To: <80d60035-6c4a-4eac-df16-956fc49901e8@aklaver.com>
  References: <CAJvUf_vLNn51OdhDDF94VwxmCyEiQDn3LwuumMY6sGsP7muc=Q@mail.gmail.com> <80d60035-6c4a-4eac-df16-956fc49901e8@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox