Using the Java client library for Google BigQuery, how does one create a view?
The relevant API call is tables.insert. With the Java API, this is represented by the create method on the BigQuery service object. You first have to create a TableInfo, which encapsulates a ViewDefinition object. The documentation for setDefinition on TableInfo.Builder says:
Sets the table definition. Use StandardTableDefinition to create
simple BigQuery table. Use ViewDefinition to create a BigQuery view.
Use ExternalTableDefinition to create a BigQuery a table backed by
external data.
Sample code:
bigQuery.create(TableInfo.of(TableId.of("DatasetName", "ViewName"),
ViewDefinition.of("SELECT this, is, the, view FROM query")))
Related
I'd like to construct a CreateTableRequest object from data annotations in a class. It looks like Amazon provides DynamoDBMapper in the Java SDK, which makes this process simple.
How can I do the same in .NET/C#?
AmazonDynamoDB dynamoDBClient = new AmazonDynamoDBClient();
DynamoDBMapper mapper = new DynamoDBMapper(dynamoDBClient);
CreateTableRequest req = mapper.generateCreateTableRequest(TestClass.class);
// Table provision throughput is still required since it cannot be specified in your POJO
req.setProvisionedThroughput(new ProvisionedThroughput(5L, 5L));
// Fire off the CreateTableRequest using the low-level client
dynamoDBClient.createTable(req);
generateCreateTableRequest is unique to the Java SDK with no equivalent (yet) for the .NET SDK.
The general .NET equivalent for Java's DynamoDBMapper is the DynamoDBContext class (docs 1, docs 2). This class provides a high-level .NET object persistence model that enables you to map your client-side classes to Amazon DynamoDB tables.
However, as per docs:
The object persistence model does not provide an API to create, update, or delete tables. It provides only data operations. You can use only the AWS SDK for .NET low-level API to create, update, and delete tables.
You will have to use the low-level .NET API to create tables.
I'm using Apache Ignite with class annotations as described in "Query Configuration by Annotations".
How should we handle class changes? For example what happen if from v1 and v2 of my application I add a new property?
Are previous values deserialized? Can I specify a default value?
I cannot find any documentation on this topic. I have tried with a simple use case and seems that new properties are null. How can I handle this?
UPDATE
Following suggestions from #dmagda I have tried to add a property on my class, adding it to the table using ALTER TABLE MYTABLE ADD COLUMN myNewProperty varchar; and then changing it's value using UPDATE MYTABLE SET myNewProperty='myDefaultValue'.
But unfortunately running the abode UPDATE I get the exception: Error: class org.apache.ignite.binary.BinaryObjectException: Failed to unmarshal object with optimized marshaller (state=50000,code=0)
It is possible to update existing records by changing new fields using SQL? How?
UPDATE 2
Solved my problem. It was caused by the fact that my class was written in scala with some scala specific types ('Map', ...). My app connects to Ignite using client mode and so when executing UPDATE from sqlline utility Ignite was unable to deserialize the types.
Now I switched my class to be plain POJO and now I'm able to update schema and update data.
Just update your Java class by adding a new field and it will be stored and can be read back without any issue. You might see null as a value of the new field for two reasons:
It was not set to any specific value by your application
You're reading back from Ignite an old object which was stored before you updated your class and, thus, the new field didn't present there.
If you need to access the new field using SQL, then use ALTER TABLE command to add the field to the SQL schema.
I am developing a web application using Spring Boot and Vaadin Framework which suppose to have a feature of processing Microsoft Excel documents, storing data from spreadsheets in custom Java objects, and finally persisting them to database. I am using the Excel Uploader add-on from Vaadin's directory which handles this kind of stuff.
As it is shown in the official examples to this add-on, it perfectly works for populating Vaadin Grid component with data from a spreadsheet and reads it properly with no issues. However, I have problems when I try to store this data in a custom object and call any method of this data type, due to the ClassCastException. This exception is thrown because the program tries to cast objects of the same data types. The thing is that whenever I want to add a SucceededListener using a lambda, the data gathered from an excel document is referenced as a collection of the generic Object type, hence it is needed to cast it to a custom object in order to call specific methods. However, when the program runs and I try to upload an excel document via UI this exception is thrown because that collection of generic Objects becomes a collection of custom data types at some moment.
This is the method where the Excel Uploader is configured:
public void configureExcelUploader() {
ExcelUploader<Person> excelUploader = new ExcelUploader<>(Person.class);
excelUploader.addSuccededListener((event, items)) -> {
List<Person> persons = (List<Person>) items;
persons.callCustomMethod();
});
Upload uploadButton = new Upload("Upload");
uploadButton.setReceiver(excelUploader);
uploadButton.addSucceededListener(excelUploader);
}
I probably miss something or simply do not how to do this kind of operation properly. Is there anyone who knows a proper way of storing results in a custom object in this particular case?
I solved this problem by removing DevTools from maven dependencies and everything worked perfectly.
we have created a jBPM workflow where we are passing custom object to create a workitem, we are passing this custom object as Map params.
Now using REST API "List getTasksAssignedAsPotentialOwnerByStatus" we can retrieve the TaskSummary for assigned userId, here TaskSummary object is predefined with fields, can anybody please guide me if i want to customize my response (i.e. if i want to retrieve additional parameters in the TaskSummary) then how can i do it using REST API?
The task summary should link a content id (in task data), containing the parameters you passed. Use this content id to get the content.
I have a created a custom field in Contacts object in Salesforce whose API name is "Resume_Text__c" and I'm making a SOAP call to get the value of that filed using Java Implementation by writing a following SOQL.
SELECT Resume_Text__c FROM Contact
But execution of query throwing following exception.
No such column 'Resume_Text__c' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.'
So how can I access custom field via Soap API Java Implementation?
Whenever you are using Enterprise.wsdl file in your implementation, you need to make sure that every time you create some new fields and object on Salesforce.com environment, you refresh your Enterprise.wsdl to import all the dependency mappings else go with Partner.wsdl.