Skip to content

Specify Sql Objects #8

@knajem

Description

@knajem

When working with incomplete databases in source control, it would be nice to extract only specific tables that you want to add at any given moment.

Adding an additional parameter to the extraction method -sql_objects dbo.table1,dbo.view5,dbo.view8

` var sqlObjects = new List<Tuple<string, string>>();

        if (!string.IsNullOrEmpty(_args.Sql_Objects)){
            sqlObjects = new List<Tuple<string, string>>();
            var argSqlOjects = _args.Sql_Objects.Split(',').ToList();
            argSqlOjects.ForEach(x =>
            {
                var schemaSplit = x.Split('.');
                if (schemaSplit.Length != 2)
                    throw new Exception($"Invalid Sql Object specified: {x}");

                sqlObjects.Add(new Tuple<string, string>(schemaSplit[0], schemaSplit[1]));
            });
        }

`

And then later on

services.Extract(_workDirectory, _args.DatabaseName, "bazel", Version.Parse("0.0.1"), tables: sqlObjects.Count() == 0 ? null : sqlObjects, extractOptions: options);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions