ALTEREXTERNALTABLEesempi - Amazon Redshift

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

ALTEREXTERNALTABLEesempi

I seguenti esempi utilizzano un bucket Amazon S3 situato nella regione Stati Uniti orientali (Virginia settentrionale) () us-east-1 Regione AWS e le tabelle di esempio create in for. Esempi CREATE TABLE Per ulteriori informazioni su come utilizzare le partizioni con tabelle esterne, vederePartizionamento delle tabelle esterne di Redshift Spectrum.

L'esempio seguente imposta la proprietà della numRows tabella per. SPECTRUM SALEStabella esterna a 170.000 righe.

alter table spectrum.sales set table properties ('numRows'='170000');

L'esempio seguente modifica la posizione diSPECTRUM. SALEStabella esterna.

alter table spectrum.sales set location 's3://redshift-downloads/tickit/spectrum/sales/';

L'esempio seguente modifica il formato perSPECTRUM. SALEStavolo esterno in Parquet.

alter table spectrum.sales set file format parquet;

L'esempio seguente aggiunge una partizione per la tabella. SPECTRUM SALES_PART.

alter table spectrum.sales_part add if not exists partition(saledate='2008-01-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01/';

L'esempio seguente aggiunge tre partizioni per la tabella. SPECTRUM SALES_PART.

alter table spectrum.sales_part add if not exists partition(saledate='2008-01-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01/' partition(saledate='2008-02-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-02/' partition(saledate='2008-03-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-03/';

L'esempio seguente cambia. SPECTRUM SALES_ PART con cui eliminare la partizione. saledate='2008-01-01''

alter table spectrum.sales_part drop partition(saledate='2008-01-01');

L'esempio seguente imposta un nuovo percorso Amazon S3 per la partizione con saledate='2008-01-01'.

alter table spectrum.sales_part partition(saledate='2008-01-01') set location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01-01/';

L'esempio seguente cambia il nome di sales_date in transaction_date.

alter table spectrum.sales rename column sales_date to transaction_date;

L'esempio seguente imposta la mappatura delle colonne sulla mappatura della posizione per una tabella esterna che utilizza il formato ottimizzato row columnar (). ORC

alter table spectrum.orc_example set table properties('orc.schema.resolution'='position');

L'esempio seguente imposta la mappatura delle colonne sulla mappatura dei nomi per una tabella esterna che utilizza il formato. ORC

alter table spectrum.orc_example set table properties('orc.schema.resolution'='name');