?>

uProc + PostgreSQL Integrations

Appy Pie Connect allows you to automate multiple workflows between uProc and PostgreSQL

About uProc

uProc is a multipurpose data platform: clean, verify or enrich any field in forms, databases, files or applications with multiple categories supported (persons, companies, products, communications, social...).

About PostgreSQL

PostgreSQL is a leading object-relational database management system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.

PostgreSQL Integrations
PostgreSQL Alternatives

Connect the apps you use everyday and find your productivity super-powers.

  • MSSQL MSSQL
  • MySQL MySQL
Connect uProc + PostgreSQL in easier way

It's easy to connect uProc + PostgreSQL without coding knowledge. Start creating your own business flow.

    Triggers
  • New Column

    Triggered when you add a new column.

  • New Row

    Triggered when you add a new row.

  • New Row (Custom Query)

    Triggered when new rows are returned from a custom query that you provide. Advanced Users Only

    Actions
  • Select Tool

    Select a tool to perform verification or enrichment

  • Create Row

    Adds a new row.

  • Update Row

    Updates an existing row.

How uProc & PostgreSQL Integrations Work

  1. Step 1: Choose uProc as a trigger app and Select "Trigger" from the Triggers List.

    (30 seconds)

  2. Step 2: Authenticate uProc with Appy Pie Connect.

    (10 seconds)

  3. Step 3: Select PostgreSQL as an action app.

    (30 seconds)

  4. Step 4: Pick desired action for the selected trigger.

    (10 seconds)

  5. Step 5: Authenticate PostgreSQL with Appy Pie Connect.

    (2 minutes)

  6. Your Connect is ready! It's time to start enjoying the benefits of workflow automation.

Integration of uProc and PostgreSQL

This article will discuss the integration of uProc and PostgreSQL. First, what is uProc? uProc is a human-readable language for describing procedures for an application. It is mostly used in the JVM world, where it is used to implement the business logic of an application. Any programmer can write uProc and they will be able to understand it. In this article, I will use uProc to describe the business logic of an application. Then what is PostgreSQL? PostgreSQL is a relational database management system. It is open source and free. It is object-relational database management system and can store multidimensional data. PostgreSQL can access data over the network and can be accessed through the SQL interface. In this article, PostgreSQL will be used as a storage engine for uProc’s business logic.

The goal of this section is to describe the integration of uProc and PostgreSQL. First, I will explain how uProc can be integrated with PostgreSQL. Then, I will explain how uProc can be used to express complex business logic in an easy way by using PostgreSQL as its storage engine.

To integrate uProc with PostgreSQL, first we need to install PostgreSQL on a machine. Then we need to install uProc on that machine. Now we will use the fplowing example to demonstrate how to integrate uProc and PostgreSQL together. In this example, PostgreSQL will store entities, which will include their name and gender attributes. Entities will be stored in database tables with two cpumns. name and gender. The names of these two cpumns come from the name attribute of entities, while the gender attribute is stored in the gender cpumn. To store entities in database tables, we need to create a table schema. Create a file named users.ucp, then add the fplowing code to it:

UNFOLD { <entity> = { <name> = <string> ; <gender> = <string> ; } } CREATE TABLE USERS ( NAME VARCHAR ( 64 . NOT NULL , GENDER VARCHAR ( 1 . NOT NULL , PRIMARY KEY ( NAME ), FOREIGN KEY ( GENDER . REFERENCES GEN_PREFIX . GEN_RANGE_ROW_FIRST ( GEN_SEQ . GEN_SEQ , GEN_SEQ . GEN_SEQ_ID ), FOREIGN KEY ( NAME . REFERENCES USERS . ENTITY , FOREIGN KEY ( GENDER . REFERENCES GEN_PREFIX . GEN_RANGE_ROW_SECOND ( GEN_SEQ . GEN_SEQ , GEN_SEQ . GEN_SEQ_ID ), FOREIGN KEY ( ENTITY . REFERENCES USERS . ENTITY ); CREATE INDEX ON USERS ( NAME ); CREATE INDEX ON USERS ( GENDER ); CREATE INDEX ON USERS ( ENTITY ); ALTER TABLE USERS ADD CONSTRAINT USERS_NAME UNIQUE ( NAME ); ALTER TABLE USERS ADD CONSTRAINT USERS_GENDER UNIQUE ( GENDER ); ALTER TABLE USERS ADD CONSTRAINT USERS_GENENTITY UNIQUE ( ENTITY );

In this example, “<entity>” is a variable that stores entities in an entity repository. An entity repository is used to store entities that are being accessed by different services and applications. “CREATE TABLE…ALTER TABLE” is used to create a table schema and add constraints to it respectively. A constraint determines whether or not something is right or wrong about a certain data structure. This example defines six constraints. two unique constraints and four foreign key constraints. The first unique constraint states that each entity must have a unique name. The second unique constraint states that each entity must have a unique gender attribute value. Foreign key constraints state that a certain field can only be referenced by certain fields of other tables; otherwise, they make no sense. For instance, this example creates a foreign key constraint to determine that both entities in two tables should have the same gender attribute value in order for them to be linked together. As you can see, foreign key constraints are useful when we want to link two tables together because they ensure that all values in one table are valid values in another table. The last three lines are used to add indexing to database tables so that we can quickly retrieve data from our database tables. Indexing is used to speed up data retrieval from database tables because data retrieval requires less operations when indexing is applied to database tables.

We now have a database table schema, but we have not defined any entities in the entities repository yet. To do so, we first need to define an entity modeler class and then define entities in it. We can do this by adding the fplowing code to the users.ucp file:

import com . github . javaprocess . uproc . impl . processor . Processor as Processor import com . github . javaprocess . uproc . impl . processor . ProcessorException import com . github . javaprocess . uproc . impl . util . UprocException import com . github . javaprocess . uproc . impl . util . UprocUtil import com . github . javaprocess . uproc . impl . util . Uprocs import com . github . javaprocess . uproc . impl . util . UprocsImpl import java . util . ArrayList class Users extends UprocsImpl { def PROCESSOR = Processor @Uprocs ( "users" . def users ; } #transition users = [ #variable(key(ENTITY). ] ArrayList ([ #variable(name. ]. def entity = { #variable(name. = [ #variable(gender. ] } def PROCESSOR = { users = processor #applies(entity. processor = new Processor (. processor -> source(source. processor -> target(target. processor -> processor(processor. processor -> /!=(processor. processor = null } def source = { getEntities(. } def target = { targetEntities(. } def processor = { processor } def getEntities (. { return users } def targetEntities (. { users = null } }

In this example, we have defined an entity modeler class named Users that extends UprocsImpl class provided by Uprocs library. First of all, we have made sure that our class inherits from UprocsImpl class by using @Uprocs annotation, which requires us to set its name property value using ‘users’ string literal. Next, Users class contains a variable named users, which refers to an array list which contains entities retrieved from the entities repository when this class is executed. Finally, Users class contains PROCESSOR variable which refers to Processor object created by our class. This object is called Processor because it processes entities retrieved from the entities repository when this class is executed; thus, it may generate exceptions or errors if there are erroneous or missing entities retrieved from the entities repository during processing. It also has many methods such as “getEntities” and “targetEntities” methods which are used to retrieve entities from the entities repository and store them into variables named “users” and “users” respectively when this class is executed.

Now let’s examine the code inside our PROCESSOR variable:

Uprocs variable named “users” refers to a users variable which refers to an array list containing entities retrieved from the entities repository by our domain modeler class Users when it is executed; thus, it may contain many entities retrieved from the entities repository inside it when this class is executed; however, it may only contain one entity retrieved from the entities repository when it is invoked directly via uProc script only because it returns null if no entity exists inside it when invoked directly via uProc script; however, it may contain many entities retrieved from the entities repository when it is invoked by our domain modeler class Users because it returns null if no entity exists inside it when invoked by our domain modeler class Users; however, Users class may only contain one entity retrieved from the entities repository when it is invoked directly via uProc script only because it returns null if no entity exists inside it when invoked directly via uProc script since Users class only contains one entity retrieved from the entities repository inside it; however, Users class may not contain any entity retrieved from the entities repository inside it when invoked by our domain

The process to integrate uProc and PostgreSQL may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.