Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First suggestion on the structure of input files #55

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ultet/examples/database/src/main/.gitkeep

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2023 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

-- owner: some_owner_user
-- database: example_db ( user_for_access )
CREATE OR REPLACE FUNCTION my_schema._internal_function(
IN i_parameter TEXT,
OUT status INTEGER,
OUT status_text TEXT
) RETURNS record AS
$$
-------------------------------------------------------------------------------
--
-- Function: my_schema._internal_function([Function_Param_Count])
-- [Description]
--
-- Parameters:
-- i_parameter -
--
-- Returns:
-- status - Status code
-- status_text - Status text
--
-- Status codes:
-- 10 - OK
--
-------------------------------------------------------------------------------
DECLARE
BEGIN

END;
$$
LANGUAGE plpgsql VOLATILE SECURITY DEFINER;
1 change: 1 addition & 0 deletions ultet/examples/database/src/main/my_schema/dbowner.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
some_owner_user
38 changes: 38 additions & 0 deletions ultet/examples/database/src/main/my_schema/my_table.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright 2023 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

table: my_schema.my_table
description: This is an example table
primary_db: example_db
owner: some_owner_user
columns:
lsulak marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what about constraints? Like the UNIQUE at least?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later phase. For now, it will be just unique index (hope we manage indexes)

- id_key_field:
type: bigint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does you expect to have comment on this line? Maybe they would be usefull.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on what? The field comment is in the description field.

not_null: true
description: Skype username
- some_name:
type: text
not_null: false
description: Aggregation name
- item_tags:
type: text[]
not_null: true
description: Array of values
primary_key:
pk_my_table:
columns: [id_key_field]
indexes:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps an option to specify type of index can be needed..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, index properties can be added. If missing the PG default is to be used. (Same for fields actually)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

idx_some_name:
columns: [some_name]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foreign keys will be supported too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the start no. FK can be omitted when using functions for data entry.

45 changes: 45 additions & 0 deletions ultet/examples/database/src/main/my_schema/public_function.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2023 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-- owner: some_owner_user
-- database: example_db ( user_for_access )
CREATE OR REPLACE FUNCTION my_schema.public_function(
IN i_parameter TEXT,
OUT status INTEGER,
OUT status_text TEXT
) RETURNS record AS
$$
-------------------------------------------------------------------------------
--
-- Function: my_schema.public_function([Function_Param_Count])
-- [Description]
--
-- Parameters:
-- i_parameter -
--
-- Returns:
-- status - Status code
-- status_text - Status text
--
-- Status codes:
-- 10 - OK
--
-------------------------------------------------------------------------------
DECLARE
BEGIN

END;
$$
LANGUAGE plpgsql VOLATILE SECURITY DEFINER;
Loading