warehouse_tables

Replace the file of a table made from an uploaded file

Changed on

Point a table made from an uploaded file at a new upload, then import it with one full refresh. Upload the new file with upload_file first. The table keeps its id and its name, and its rows are replaced when the sync finishes. The old file is deleted only after that sync succeeds. The sync bills its rows like any other import.

post/api/projects/{project_id}/warehouse_tables/{id}/replace_file/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/warehouse_tables/{id}/replace_file/
  • Auth: HTTP bearer

Path parameters

idstring uuid required

A UUID string identifying this data warehouse table.

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Request body

upload_idstring uuid required

Id returned by upload_file for the stored file.

filenamestring required

Sanitized filename returned by upload_file.

file_format'csv' | 'json' | 'parquet' required
  • csv - csv
  • json - json
  • parquet - parquet

Response

idstring uuid required
deletedboolean nullable

Whether the table is soft-deleted and hidden from queries.

namestring required

Name the table is queried by in HogQL. Must be unique within the project, and must start with a letter or underscore and contain only letters, numbers, and underscores.

hogql_namestring required

Dotted name the table is queried by in HogQL (e.g. googleanalytics.devices or postgres.<prefix>.<table>), as opposed to name, which is the underlying storage identifier.

format'CSV' | 'CSVWithNames' | 'Parquet' | 'JSONEachRow' | 'Delta' | 'DeltaS3Wrapper' required
  • CSV - CSV
  • CSVWithNames - CSVWithNames
  • Parquet - Parquet
  • JSONEachRow - JSON
  • Delta - Delta
  • DeltaS3Wrapper - DeltaS3Wrapper
created_atstring date-time required
url_patternstring required

HTTPS URL of the files to read, with * matching any part of a path segment (e.g. https://your-bucket.s3.amazonaws.com/orders/*.parquet). All matched files are read as one table. Must point at a bucket you control, not at PostHog's own storage.

columnsobject[] required
external_schemaobject nullable required
optionsobject

Per-format read options. The only one read today is csv_allow_double_quotes (boolean), for CSV files that quote fields with doubled quotes.

user_access_levelstring nullable required

The effective access level the user has for this object

Changes

    • warning

      added the new AwsDocumentDB enum value to the ///////// response property for the response status

    • warning

      added the new CloudflareD1 enum value to the ///////// response property for the response status