Pentaho Kettle sql uid - kettle

I need to load data from a csv to database. Those tables also used by application code, and table primary keys are generated by hibernate uid.
How do I create these primary key uid from kettle?
I appreciate any help.
Thanks,
Sam

Use the "Generate Random Value" step - this can generate uuids etc.

Related

Is it possible to retrieve the Timestream schema via the API?

The AWS console for Timestream can show you the schema for tables, but I cannot find any way to retrieve this information programatically. While the schema is dynamically created from the write requests, it would be useful to check the schema to validate that writes are going to generate the same measure types.
As shown in this document, you can run the command beneath, it'll return the table's schema.
DESCRIBE "database"."tablename"
Having the right profile setup at your environment, to run this query from the CLI, you can run the command:
aws timestream-query query --query-string 'DESCRIBE "db-name"."tb-name"' --no-paginate
This should return the table schema.
You can also retrieve the same data running this query from source codes in Typescript/Javascript, Python, Java or C# just by using the Timestream-Query library from AWS's SDK.
NOTE:
If the table is empty, this query will return empty so, make sure you have data in your db/table before querying for it's schema, ok? Good luck!

Database connection and save data from c++ program to MySQL

I never had to deal with database, therefore, sorry in advance!
I was asked to create a database for a project and store data output from a c++ program into the database. I informed on Google about databases, and I came across with MySQL, and in particular database connection. As far as I understood, in the first place a database has to be created (for example with MySQL), and once data are inserted, it’s possible to access to them. However, it’s not totally clear what is possible to achieve with such a connection and how to save data from a c++ program into the database directly.
Based on what I read on the net, these should be related, is it right? I would really need some help, example or clarification about these two questions. Thanks in advance for your time!
First you should create DB and tables.
You can do it in each DB IDE wizards, or you can write it in a script.
So here are scrypt for MySQL
CREATE DATABASE test_db --this create DB called test_db
I guess you should store a message and a timestamp so a possible table (In MySQL) will be:
USE test_db -- from now on the script using test_db unless specified explicit DB
--creating table with id, mmessage and timestamp
CREATE TABLE output_table (
msg_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
msg VARCHAR(max),
msg_TS TIMESTAMP DEFAULT CURRENT_TIMESTAMP)
In the above table you only need to give the message since all the rest are filled automatically. So Insert into the table command may look like this:
INSERT INTO output_table (msg) values ('this is a message')
When you want to check the whole table you run the following:
SELECT * FROM output_table
Now you need to connect this code to your c++ code:
Generally, you'll need to know db name, user name and password in manner to connect to DB.
You can use ODBC + MySQL ODBC Connector. It is better since you are not limitted in your c++ to a specific DB. If you are sure you will use only MySQL you can use also MySQL C++ Connector directly. Anyway, both will give you option to run SQL commands on your DB.
HERE you can fine MySQL c++ connector sample
HERE you can find ODBC sample.

informatica powercenter express pass variable to multiple mappings

Background: I am new to Informatica. Informatica powercenter express Version: 9.6.1 HotFix 2
In my etl project I have several mappings to load different dimension and fact tables in a data mart. The ETL will run daily, one requirement is to add a audit key as a column to each of these tables. The audit key is an integer and is generated from a audit table (next value from the audit key column (primary key)). So everyday the audit key is increased by 1 etc. So after each etl load, all the new or updated rows in all tables (dimension/fact) will have this audit key in a column. The purpose is the ability to trace when or how each row is inserted/updated etc.
Now the question is how to generate such key and pass on to all the mappings? The key should be from the next value from auditkey column of audit table.
You could build a mapplet that generates/maintains the key you want and use it in all your workflows
If you have a RDBMS source, I would suggest creating a oracle sequencer in the DB and create oracle function to get the next value...
Call the the newly created oracle function in SQL Override and use the next value sequence number in all the mapping

Using UNIX SAS to ascertain Netezza DISTRIBUTE_ON key

Is anybody able to provide some SAS 9.1.3 code for ascertaining the DISTRIBUTE_ON key of a particular Netezza table?
have tried using the guidance here but the table comes back empty..
There is a nzsql command called \d which will retrieve the distribution keys on the table. Check the NZ Database User Guide.
Regards,
Venk

How to query a DB table from C++

I have C++ code, and from it I need to access the DB and make a query in table (with name NECE_TABLE, which has 2 columns - IntID and Status).
Here I need to get "status" column value from DB table (NECE_TABLE) using the IntID from C++ code.
Any help will be greatly helpful. Thanks in advance
Your question is very vague, but in summary you need to:
Use an appropriate client library supported by your database to connect to that database using some user credentials with appropriate permissions for SELECTing from your table
Execute a SQL select to fetch the data you want
There's some confusion as to which database you're using.
If you're using Oracle, you can use the OCCI client library to connect to the database and execute SQL statements. See section 2 of the linked document, where it describes connecting to a database and executing SQL queries.
Take a look at this link - it's a simple tutorial on how to get started with MySQL and C++. You say you are using vanilla SQL in your tags, but the two should be compatible as long as you stick to the more basic queries.