Skip to content

Add option to create schema tables without constraints #81

Open

Description

@anthonysena

Currently, generateSqlSchema will generate SQL to create a schema based on the results data model specification which may include constraints (primary keys at the moment). In the case that we are bulk-loading results from a study, we may want to add constraints after data is loaded.

I'd propose we extend generateSqlSchema to allow for a new parameter includeConstraints = TRUE so we can optionally disable constraints. The add another function generateSqlContraints to generate the SQL necessary to apply any/all constraints.

Activity

  1. azimov commented on Aug 28, 2025

    @azimov
    Collaborator

    This could be included but it will likely be challenging to add constraints in afterwards.
    The develop branch currently has a function for using python postgres uploads that disables the constraints on the fly.
    I wonder if this approach is more useful in the circumstance where the data sets are large?

    Disabling constraints will also not necessarily disable custom indexes, which is generally the reason for slow insert times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions