I need to create a model from a stored procedure. The stored procedure is in SQL Server. I tried using the discover api to fetch the model, but it seems loopback isn't that advanced. I browsed the StrongLoop docs to find out if something like that can be done, but dint have any luck.
I am trying to create an API that would return me the data from the stored proc. I hope there is such a thing.
I had the same problems locating how to do the exact same thing.
I have been looking at using this instead.
Transactional SQL with Sails.js
I do wish sprocs were clearly documented as being doable with strongloop, because I love all the other features.
If it does, it would be with the native query feature:
http://docs.strongloop.com/display/public/LB/Executing+native+SQL
Related
I would like to disable my rails application's oracle database partitioning, but :
I don't know how to tell whether my app is using database partitioning
I don't know how to find the place my app use partitioning, since I didn't write most of the application's code myself
Can I just system search the code base for the keyword 'Partition' and look for any result that has the key word partition in raw SQL statement?
How should I go about this?
Thanks!
Update:
I have 2 answers below and they seem to understand my question differently
I am confused now as well. I want to disable the partition feature of my Oracle Database (https://www.oracle.com/technetwork/database/options/partitioning/overview/index.html), does that means I cannot use the 'partition by' keyword (Oracle "Partition By" Keyword) anymore?
Partitioning is done at the schema level declaratively. Usually, one would not expect the application code to directly need anything specific to use partitioning since it is done at the data definition level. You can connect to the schema owner account and check the data dictionary views USER_PART_TABLES for partitioned tables owned by the user and USER_PART_INDEXES for the indexes.
I was introduced recently to the Advantage Database technology, and I now have to use it to interface with a legacy software on Win 7. I have successfully followed the advantagezone development help files in order to install both the ADS and the ODBC driver. A few questions remain, the first of which being the following: How does one change the password of a user/add a user?
I was unable to find any documentation regarding this matter. Could you point me to the relevant documentation or provide me with the command necessary to do so via command line?
Also I was wondering if there were any sort of GUI to manage the ADS, like MySQL has with PHPMyAdmin or the MySQL workbench.
Thanks for your help!
Advantage Database Server (ADS) uses a somewhat strange concept they've confusingly called a Data Dictionary (DD), which when used as designed controls users, rights, security, and access similar to what most DBMSs offer in the database itself.
Basically the only way to work with the ADS DD is through their GUI, known as the Advantage Data Architect (ARC32), which is available for download from the ADS Developer Zone. (You can do it via code, but for the types of things a DBA would do it's much easier to do things via ARC32.) Using it, you can create most of the types of things you'd typically use in a DBMS.
ARC32 also allows you to design your tables and indexes, as well as running SQL DDL and DML statements. The supported SQL grammar is also available in the documentation and covered in the book mentioned below.
You can find the documentation in ARC32 itself (using the Help menu or the ? on the toolbar), or via their Online Help FIles. The best place to start is in the topic The Advantage Developer's Guide, which is actually the entire contents of the book Advantage Database Server: A Developer's Guide. The book contains pretty good documentation on all of the aspects of both ARC32 and ADS itself, including use of the DD. Part 1, Chapter 4 has an entire section on adding users.
I know that it is possible to retrieve data from a SQL Server table using webservices that return pure XML (as explained here), but that will not allow me to add records to the table, right?
I am primarily a C# .NET programmer, but I have dealt a little with iOS development. Is there a way I can use some sort of iOS-equivalent to a TableAdapter to add records to the table? The app would be running on the same network the servers are connected to.
As deterministicFail, Sean Lange, and Adam stated in the comments, it is possible using a web service.
If anyone else is looking for some information on this topic, I found an article that explains this process in more detail. Click here to go to the article.
Thanks for the help, everyone.
Let's say your app enables users to create their own tables in the database to hold their own, custom data. Each table would have it's own schema. What are some good approaches?
My first stab involved dynamically creating migration files and model files bu I'd like to run this on heroku where you can't write to the filesystem.
I'm thinking eval may be the way to go to create and run the migration class and the model class. But I want to make sure the model class exists when a new process of the app is spawned. Can probably do this by storing these class definition with each user as they create new tables and then run through them all at startup. But now it's convulted enough that I may be missing something obvious.
It's probably a better idea not to generate new classes on runtime. Besides all of the security risks, each thread's startup time will be abominable if you ever get a significant number of users.
I would suggest rethinking your app design and aim at generic tables to hold the user's custom data. If you have examples of data structures that users can create we might be able to help.
Have you thought about a non-sql database for those tables? Look at CouchDB - there are several plugins on Github that integrate it with rails. Records in the database are JSON documents, with arbitrary key-value structure. May be perfect for a user-defined schema.
There is (was?) a cool Wiki project, called Informl. It was a Wiki, not just for web pages but for web applications. (Get it? It's informal because it's a Wiki, it's got forms because it is an application, and it's user-generated, thus Web 2.0, which means that according to an official UN resolution it is legally required to have a name which is missing a vwl.)
So, in other words, it was not just about user-generated content, but also user-generated structured data.
They did this by generating PostgreSQL-specific SQL at runtime to create new tables and then have ActiveRecord reload the schemas.
The code is up on RubyForge. It's based on Rails 1.2.3. I guess you could do much better than that today, especially with the upcoming extensibility interfaces in Rails 3.
I shudder to ask, but my client might offer no other SQL (or SQL-like) solution. I know Access has some SQL hooks; are they enough for basic ActiveRecord?
Later:
I appreciate all the suggestions to use other databases, but trust me: I've tried convincing them. There is an "approved" list, and no SQL databases are on it. Getting something onto the list could take more than a year, and this project will be done in three weeks.
It's a long shot but there's an ODBC adapter for ActiveRecord that might work.
There seems to be something of an Access connection adapter here: http://svn.behindlogic.com/public/rails/activerecord/lib/active_record/connection_adapters/msaccess_adapter.rb
The database.yml file would look like this:
development:
adapter: msaccess
database: C:\path\to\access_file.mdb
I'll post more after I've tried it out with Rails 2.1
Another option that is more complicated but could work if you were forced to do it, is to write a layer of RESTful web services that will expose Access to rails. If you are careful in your design, those RESTful web services can be consumed directly by ActiveResoure which will give you a lot of the functionality of ActiveRecord.
There are some wierd things in Access that might cause issues and I don't know if ODBC takes care of it. If it does #John Topley is right, ODBC would be your only cance.
True in access = -1 not 1
Access treats dates differently than regular TSQL.
You might run into trouble creating relations.
If you go with access, will probably learn more about debuging AcriveRecord then you ever cared to ( which might not be a bad thing)
Maudite wrote:
True in access = -1 not 1
Not correct. True is defined as not being false. So, if you want to use True in a WHERE clause, use Not False instead. This will provide complete cross-platform compatibility with all SQL engines.
All that said, it's hardly an issue, since whatever driver you're using to connect to your back end will properly translate True in WHERE clauses to the appropriate value. The only exception might be in passthrough queries, but in that case, you should be writing the SQL outside Access and testing it against your back end and just pasting the working SQL into the SQL view of your passthrough query in Access.
Maudite wrote:
Access treats dates differently than regular TSQL.
Again, this is only going to be an issue if you don't go through the ODBC or OLEDB drivers, which will take care of translating Jet SQL into TSQL for you.
Maudite wrote:
You might run into trouble creating relations.
I'm not sure why you'd want an Access application to be altering the schema of your back end, so this seems to me like a non-issue.
You should really talk them into allowing SQLite. It is super-simple to setup, and operates like Access would (as a file sitting next to the app on the same server).
Firstly, you really want to be using sqlite.
In my experience Access itself is a pile of [redacted], but the Jet database engine it uses is actually pretty fast and can handle some pretty complex SQL queries. If you can find a rails adapter that actually works I'd say you'll be fine. Just don't open the DB with the access frontend while your rails app is running :-)
If your client is anal enough to only allow you to develop with an approved list of databases, they may be more concerned by the fact that Jet is deprectated and will get no more support from MS.
This might give you some ammunition in your quest to use a real database. Good luck