Execute complex query using Session (coldfusion.air.session class) - orm

We are working on a sync application using ColdFusion 9.0.1 ActionScript ORM Library for AIR applications. Since this is application should work smoothly offline as well, there is a list of clients that has to be loaded when a user logs in, hence we are fetching data from all the required tables when application loads (is that the right way?). Now when we get the data from the required tables then based on the user who logs in we have to filter the clients, to filter this the query required is a complex one with joins between 5-6 tables and where clause. What I found that using the Coldfusion.Air.Session class we can only load objects of tables with simple where clause. There is non ORM way to load the data but I don't think that is the right method. Is there any method using this ORM framework to load data using such complex queries.
Thanks,
Gaurav

Are you using any CF code to send data back to your application? Have you tried HQL?
In other words you can write standard cfquery and dbtype="hql"
This will let you do almost anything you can do with a standard cfquery.
I am not directly familiar with the ActionScript ORM Library for AIR.

Related

Is it possible to access an SQL database migrated using Django with a JavaScript ORM instead of raw SQL for a microservice architecture?

Suppose that I have an app where the models have been created using Django ORM and Django acts like an API for authentication and gives control to the relation model User using its ORM. At the same time, we want to use Express JS to continuously update a field in one the User model for some feature that requires performance. Is it possible to use a JavaScript ORM with Express JS to update such field? If yes, then how?
In the following tutorial tutorial for Golang, the database is created using SQL and a table called go_test_model is created. Then he uses the struct called GoTestModel to create a row in the table go_test_model.
This basically means that if we create an app called api in Django and add in it a model called Example, then to handle that model in Golang we just create a struct called ApiExample and from there we can have CRUD access to the same table, there might be some conflicts in the fields datatypes between GORM and Django ORM but integrity is still applied in the database itself.
So this particular example solves my problem with Golang and can be replicated using Node JS.
You can use Sequelize for using native functions for performing queries instead of writing raw queries.
Also, please refer to Models section to define models.

Query Builder vs. ORM?

What is the difference between a query builder and an ORM that developers use in their backend server-side code/logic for interacting with their database? It seems like the query builder can fulfill the goal of coding in the same language you are choosing to write the backend server-side code/logic to work with the database. However, I don't understand why an ORM comes in the picture then.
SQL query returns records (scalars) that do not automatically load more data if needed.
ORM can return you a Java object (say Person) with actual working methods that can load more data from database (without writing more queries explicitly).
For example if you call person.getAddress() it can return Address object that's just loads from database on the fly. Without writing new "select address" query.
Whatever is returned form SQL query (builder) does not work like that.

Convert an online JSON set of files to a relational DB (SQL Server, MySQL, SQLITE)

I'm using a tool called Teamwork to manage my team's projects.
The have an online API that consists of JSON files that are accessible with authorisation
https://developer.teamwork.com/projects/introduction/welcome-to-the-teamwork-projects-api
I would like to be able to convert this online data to an sql db so i can create custom reports for my management.
I can't seem to find anything ready to do that.
I need a strategy to do this..
If you know how to program, this should be pretty straightforward.
In Python, for example, you could:
Come up with a SQL schema that maps to the JSON data objects you want to store. Create it in a database of your choice.
Use the Requests library to download the JSON resources, if you don't already have them on your system.
Convert each JSON resource to a python data structure using json.loads.
Connect to your database server using the appropriate Python library for your database. e.g., PyMySQL.
Iterate over the python data, inserting rows into the database as appropriate. This is essentially the JSON-to-Tables mapping from step 1 made procedural.
If you are not looking to do this in code, you should be able to use an open-source ETL tool to do this transformation. At LinkedIn a coworker of mine used to use Talend Data Integration for solid ETL work of a very similar nature (JSON to SQL). He was very fond of it and I respected his opinion, so I figured I should mention it, although I have zero experience of it myself.

Sencha Mysql Queries

I'm about to port an Android-Travellog App to other Plattforms using Sencha Touch.
The Problem is, that Sencha only has a Store System to store Data, but doesnt appear to have a possibilty to acctually make MySql queries.
And since most of the Mysql code in my previous app is already there, id would be quite a pain to redo everything with Senchas new System.
Is there a possibilty to use mysql (or any other sql) queries with Sencha to Store Data on the Phone?
Sencha stores and proxies abstract away the need to write raw query code. A store can use one of a number of different proxies for interfacing with different back-end data stores, one of which is the SQL proxy, which as you can see in the source code provides an API for basic data querying WebSQL databases.
If you want to gain the full benefit of the framework and do things the "Sencha way" you'll probably want to start from scratch and architect your app to use the stores API.

Xcode iOS phone directory app. core data, sql lite, or

as part of an application I am trying to create, I am looking to data storage solutions. However, I have found many solutions that I can not quite directly apply to the position I am in.
Basically, I want to display in my app, a directory of the staff of my organization. About 100 or so individuals. I want to have generic attributes such as name, email, office#, etc.
However, my goal is to not end up with a static representation of the staff here! (people come and go, switch offices,etc.)
I am looking for the best way (if possible) to maintain a small database that I can administer, and if perhaps, something were to change to someone here, I can make the change and the change will be reflected accordingly.
Please help! I tried submitting my first app but got rejected because I relied on a webview to accomplish this task. This is an internship opportunity and my first real chance at development. Any help will be GREATLY appreciated.
Thanks!!!!!
The iPhone directory app can be used to store data in any format you want (xml, json or a proprietary format), because all you do is save a file. But if you choose to use the iPhone app directory to store data you have to write code to read the file (very simple to do) and parse the information (not so simple because the dificulty scales based on the information complexity).
SQLite is a tool to store structured data, providing you a set of tools to access and use the information. You don't need to parse the information, because SQLite does it for you by using transact sql queries.
By now, because you have a list of individuals, and these people are relationed to offices, I think you should use SQLite.
The Code Data is a object graph management, it's a tool to give you more options over data manipulation, and can make your life very easy if you have a lot of data and very complex data models. I don't think you need that for your particular problem, but I think you should learn it at some point.
UPDATE 1
You application will have something like:
A core database (sql server, oracle, my sql, etc) will hold your individuals information (your cloud database).
A web page (php, asp.net, etc) will display the core database information in json or xml format (your api).
A iphone app will download the information from the web page and store it in the local SQLite. (you have to decide when you will update the local sql lite, like when is opened, once a week, once a moth, twice a day, etc) (your local storage method).
Display the local SQLite individuals information in the app.