Search Results

Search found 3163 results on 127 pages for 'schema'.

Page 70/127 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • Define Rails Model Persistent Attributes in Model File

    - by Kevin Sylvestre
    I recently played with MongoDB in Rails using Mongoid. I like the ability to define attributes for models within the model file (as opposed to in migrations): class Person include Mongoid::Document field :name, :type => String field :birthday, :type => Date end For projects that cannot use a schema-less database, does a similar feature exist? Any gems or plugins that generate schemas from a similar syntax would be greatly appreciated. Thanks.

    Read the article

  • Simple Java to XML example

    - by Tom Brito
    I've read a time ago about generate xml from Java using annotations, but I'm not finding a simple example now. If I want to make a xml file like: <x:element uid="asdf">value</x:element> from my java class: public class Element { private String uid = "asdf"; } Which annotations I should use to perform that? (I have a xml-schema, if this helps the generation)

    Read the article

  • XSD: xs:sequence & xs:choice combination for xs:extension elements of a common base type?

    - by bguiz
    Hi, My question is about defining an XML schema that will validate the following XML: <rules> <other>...</other> <bool>...</bool> <other>...</other> <string>...</string> <other>...</other> </rules> The order of the child nodes does not matter. The cardinality of the child nodes is 0..unbounded. All the child elements of the rules node have a common base type, rule, like so: <xs:complexType name="booleanRule"> <xs:complexContent> <xs:extension base="rule"> ... </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="stringFilterRule"> <xs:complexContent> <xs:extension base="filterRule"> ... </xs:extension> </xs:complexContent> </xs:complexType> My current (feeble) attempt at defining the schema for the rules node is below. However, Can I nest xs:choice within xs:sequence? If, where do I specify the maxOccurs="unbounded" attribute? Is there a better way to do this, such as an xs:sequence which specifies only the base type of its child elements? <xs:element name="rules"> <xs:complexType> <xs:sequence> <xs:choice> <xs:element name="bool" type="booleanRule" /> <xs:element name="string" type="stringRule" /> <xs:element name="other" type="someOtherRule" /> </xs:choice> </xs:sequence> </xs:complexType> </xs:element>

    Read the article

  • BULK INSERT from one table to another all on the server

    - by steve_d
    I have to copy a bunch of data from one database table into another. I can't use SELECT ... INTO because one of the columns is an identity column. Also, I have some changes to make to the schema. I was able to use the export data wizard to create an SSIS package, which I then edited in Visual Studio 2005 to make the changes desired and whatnot. It's certainly faster than an INSERT INTO, but it seems silly to me to download the data to a different computer just to upload it back again. (Assuming that I am correct that that's what the SSIS package is doing). Is there an equivalent to BULK INSERT that runs directly on the server, allows keeping identity values, and pulls data from a table? (as far as I can tell, BULK INSERT can only pull data from a file) Edit: I do know about IDENTITY_INSERT, but because there is a fair amount of data involved, INSERT INTO ... SELECT is kinda of slow. SSIS/BULK INSERT dumps the data into the table without regards to indexes and logging and whatnot, so it's faster. (Of course creating the clustered index on the table once it's populated is not fast, but it's still faster than the INSERT INTO...SELECT that I tried in my first attempt) Edit 2: The schema changes include (but are not limited to) the following: 1. Splitting one table into two new tables. In the future each will have its own IDENTITY column, but for the migration I think it will be simplest to use the identity from the original table as the identity for the both new tables. Once the migration is over one of the tables will have a one-to-many relationship to the other. 2. Moving columns from one table to another. 3. Deleting some cross reference tables that only cross referenced 1-to-1. Instead the reference will be a foreign key in one of the two tables. 4. Some new columns will be created with default values. 5. Some tables aren’t changing at all, but I have to copy them over due to the "put it all in a new DB" request.

    Read the article

  • How do I create/use a Fluent NHibernate convention to automap UInt32 properties to an SQL Server 200

    - by dommer
    I'm trying to use a convention to map UInt32 properties to a SQL Server 2008 database. I don't seem to be able to create a solution based on existing web sources, due to updates in the way Fluent NHibernate works - i.e. examples are out of date. I'm trying to have NHibernate generate the schema (via ExposeConfiguration). I'm happy to have NHibernate map it to anything sensible (e.g. bigint). Here's my code as it currently stands (which, when I try to expose the schema, fails due to SQL Server not supporting UInt32). Apologies for the code being a little long, but I'm not 100% sure what is relevant to the problem, so I'm erring on the side of caution. Most of it is based on this post. The error reported is: System.ArgumentException : Dialect does not support DbType.UInt32 I think I'll need a relatively comprehensive example, as I don't seem to be able to pull the pieces together into a working solution, at present. FluentConfiguration configuration = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString(connectionString)) .Mappings(mapping => mapping.AutoMappings.Add( AutoMap.AssemblyOf<Product>() .Conventions.Add<UInt32UserTypeConvention>())); configuration.ExposeConfiguration(x => new SchemaExport(x).Create(false, true)); namespace NHibernateTest { public class UInt32UserTypeConvention : UserTypeConvention<UInt32UserType> { // Empty. } } namespace NHibernateTest { public class UInt32UserType : IUserType { // Public properties. public bool IsMutable { get { return false; } } public Type ReturnedType { get { return typeof(UInt32); } } public SqlType[] SqlTypes { get { return new SqlType[] { SqlTypeFactory.Int32 }; } } // Public methods. public object Assemble(object cached, object owner) { return cached; } public object DeepCopy(object value) { return value; } public object Disassemble(object value) { return value; } public new bool Equals(object x, object y) { return (x != null && x.Equals(y)); } public int GetHashCode(object x) { return x.GetHashCode(); } public object NullSafeGet(IDataReader rs, string[] names, object owner) { int? i = (int?)NHibernateUtil.Int32.NullSafeGet(rs, names[0]); return (UInt32?)i; } public void NullSafeSet(IDbCommand cmd, object value, int index) { UInt32? u = (UInt32?)value; int? i = (Int32?)u; NHibernateUtil.Int32.NullSafeSet(cmd, i, index); } public object Replace(object original, object target, object owner) { return original; } } }

    Read the article

  • How can i get the seed value of an identity column in MySql

    - by mmcdonald
    To get the seed and step values of an identity column in sql server i can use this syntax SELECT ColumnName = name, Seed = seed_value, Step = increment_value FROM sys.identity_columns So far in MySql i have found that if i use this syntax SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE auto_increment IS NOT NULL I can at least find out which columns are an identity... The question being how can i get the SEED and STEP values of the identity column from the MySQL Schema.

    Read the article

  • Getting ORACLE programming object definitions

    - by Yaakov Davis
    Let's say I have an ORACLE schema with contains a package. That package defines types, functions, procedures, etc: CREATE PACKAGE... DECLARE FUNCTION ... PROCEDURE ... END; Is there a query I can execute to get the definitions of those individual objects, without the wrapping package?

    Read the article

  • Max value amongst 4 columns in a row.

    - by KandadaBoggu
    I have test_scores table with following fields: Table schema: id (number) score1 (number) score2 (number) score3 (number) score4 (number) Sample data: id score1 score2 score3 score4 1 10 05 30 50 2 05 15 10 00 3 25 10 05 15 Expected result set: id col_name col_value 1 score4 50 2 score2 15 3 score1 25 What is a good SQL for this?(I am using MySQL.)

    Read the article

  • Is it possible to write a database view that encompasses one-to-many relationships?

    - by Brandon Linton
    So I'm not necessarily saying this is even a good idea if it were possible, since the schema of the view would be extremely volatile, but is there any way to represent a has-many relationship in a single view? For example, let's say I have a customer that can have any number of addresses in the database. Is there any way to list out each column of each address with perhaps a number as a part of the alias (e.g., columns like Customer Id, Name, Address_Street_1, Address_Street_2, etc)? Thanks!

    Read the article

  • diffing two databases

    - by flybywire
    Is there a tool to find the difference between two databases. Both the schema and the actual data are pretty much the same, but not 100%. Do you know a tool that can help to succinctly describe the changes.

    Read the article

  • SSIS Null Value Questions

    - by Saobi
    I have a table with 5 string columns, all can be NULLs. After I read the data from this table, I want to convert any null values into empty strings. The reason is that I need to compare these columns with columns in another table of the same schema (using conditional split), and null values would cause the comparison to evaluate to NULL. Is there any functionality in SSIS that allows me to convert NULL's to empty strings, or just not having to deal with NULL's at all?

    Read the article

  • Transforming OLTP Relational Database to Data Warehousing Model

    - by Russ Cam
    What are the common design approaches taken in loading data from a typical Entity-Relationship OLTP database model into a Kimball star schema Data Warehouse/Marts model? Do you use a staging area to perform the transformation and then load into the warehouse? How do you link data between the warehouse and the OLTP database? Where/How do you manage the transformation process - in the database as sprocs, dts/ssis packages, or SQL from application code?

    Read the article

  • Can MySQL reasonably perform queries on billions of rows?

    - by haxney
    I am planning on storing scans from a mass spectrometer in a MySQL database and would like to know whether storing and analyzing this amount of data is remotely feasible. I know performance varies wildly depending on the environment, but I'm looking for the rough order of magnitude: will queries take 5 days or 5 milliseconds? Input format Each input file contains a single run of the spectrometer; each run is comprised of a set of scans, and each scan has an ordered array of datapoints. There is a bit of metadata, but the majority of the file is comprised of arrays 32- or 64-bit ints or floats. Host system |----------------+-------------------------------| | OS | Windows 2008 64-bit | | MySQL version | 5.5.24 (x86_64) | | CPU | 2x Xeon E5420 (8 cores total) | | RAM | 8GB | | SSD filesystem | 500 GiB | | HDD RAID | 12 TiB | |----------------+-------------------------------| There are some other services running on the server using negligible processor time. File statistics |------------------+--------------| | number of files | ~16,000 | | total size | 1.3 TiB | | min size | 0 bytes | | max size | 12 GiB | | mean | 800 MiB | | median | 500 MiB | | total datapoints | ~200 billion | |------------------+--------------| The total number of datapoints is a very rough estimate. Proposed schema I'm planning on doing things "right" (i.e. normalizing the data like crazy) and so would have a runs table, a spectra table with a foreign key to runs, and a datapoints table with a foreign key to spectra. The 200 Billion datapoint question I am going to be analyzing across multiple spectra and possibly even multiple runs, resulting in queries which could touch millions of rows. Assuming I index everything properly (which is a topic for another question) and am not trying to shuffle hundreds of MiB across the network, is it remotely plausible for MySQL to handle this? UPDATE: additional info The scan data will be coming from files in the XML-based mzML format. The meat of this format is in the <binaryDataArrayList> elements where the data is stored. Each scan produces = 2 <binaryDataArray> elements which, taken together, form a 2-dimensional (or more) array of the form [[123.456, 234.567, ...], ...]. These data are write-once, so update performance and transaction safety are not concerns. My naïve plan for a database schema is: runs table | column name | type | |-------------+-------------| | id | PRIMARY KEY | | start_time | TIMESTAMP | | name | VARCHAR | |-------------+-------------| spectra table | column name | type | |----------------+-------------| | id | PRIMARY KEY | | name | VARCHAR | | index | INT | | spectrum_type | INT | | representation | INT | | run_id | FOREIGN KEY | |----------------+-------------| datapoints table | column name | type | |-------------+-------------| | id | PRIMARY KEY | | spectrum_id | FOREIGN KEY | | mz | DOUBLE | | num_counts | DOUBLE | | index | INT | |-------------+-------------| Is this reasonable?

    Read the article

  • LINQ to SQL table naming

    - by Ivo
    I am using VS2010 and C# When I map/select my database tables with LINQ to SQL I have to option to change the "member" propery, but when i delete the table (because I changed something in the schema for example) and add it again the member value gets "reset". Is it possible to set/override this member programmaticly, so that I dont have to change it by hand everytime I mean the member option of '<'Table Name="dbo.table1" Member="table1"

    Read the article

  • Different information domains in DB

    - by dotnetdev
    Hi, I have a database for my personal site and at the moment it is storing different domains of information (Eg cv, CMS schema, and more, all in one DB). I have noticed that sets of tables (eg all for one domain) have no relationship to other groups of tables as they are completely unrelated. What implication does this have on database design? I can assume this is a time I need to think about having 1 DB.

    Read the article

  • SharePoint List Service Recursive not working

    - by stranger001
    Hi, I am using the following code to retrieve the documents in a list. Its working fine. However, it only returns documents and folders in root of the doc library. Is there any thing wrong I am doing here? I am looking for files in sub folders with recursive mode. Service service = new Service(); service.setMaintainSession(true); call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL("<host>/_vti_bin/lists.asmx") ); call.setOperationName(new QName("http://schemas.microsoft.com/sharepoint/soap/","GetListItems")); call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean("true")); call.setProperty(Call.SOAPACTION_URI_PROPERTY,"http://schemas.microsoft.com/sharepoint/soap/GetListItems"); call.addParameter(new javax.xml.namespace.QName("http://schemas.microsoft.com/sharepoint/soap/", "listName"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, javax.xml.rpc.ParameterMode.IN); MessageElement me = new MessageElement(new QName("QueryOptions")); me.addChildElement(new MessageElement(new QName( "IncludeMandatoryColumns"))).addTextNode("true"); me.addChildElement(new MessageElement(new QName( "ViewAttributes"))).addAttribute(javax.xml.soap.SOAPFactory.newInstance().createName("Scope"), "Recursive"); MessageElement[] me1 = {me}; String strMyString = "" + "<Query>" + "<OrderBy><FieldRef Name=\"ows_Modified\" Ascending=\"TRUE\" /></OrderBy>" + "</Query>"; MessageElement[] meArray = { getMeFromString(strMyString) };// Array call.addParameter("query",org.apache.axis.Constants.XSD_SCHEMA, javax.xml.rpc.ParameterMode.IN); call.addParameter("queryOptions",org.apache.axis.Constants.XSD_SCHEMA, javax.xml.rpc.ParameterMode.IN); call.setReturnType(org.apache.axis.Constants.XSD_SCHEMA); Schema ret = (Schema)call.invoke(new Object[] {"listGUID",meArray, me1 }); public org.apache.axis.message.MessageElement getMeFromString(final String strMyString) { DocumentBuilder docBuilder = null; try { docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (final ParserConfigurationException e) { e.printStackTrace(); } catch (final FactoryConfigurationError e) { e.printStackTrace(); } final StringReader reader = new StringReader(strMyString); final InputSource inputsource = new InputSource(reader); Document doc = null; try { doc = docBuilder.parse(inputsource); } catch (final SAXException e) { e.printStackTrace(); } catch (final IOException e) { e.printStackTrace(); } final Element ele = doc.getDocumentElement(); final MessageElement msg = new MessageElement(ele); return msg; }

    Read the article

  • use simplexml to get attributes of elements

    - by user1291894
    I am trying to parse an xml file with a soap envelope from a web service using php. I would like to use SoapClient, but I get an error back that 'page must be viewed over secure channel SSL', which I think is an issue on their end, so I gave up on that. Currently I am using curl to get a result back. Then I put it into a simplexml object like so: <?php $xml = @simplexml_load_string($result, NULL, NULL, "http://schemas.xmlsoap.org/soap/envelope/"); $xml->registerXPathNamespace('xs', 'http://www.w3.org/2001/XMLSchema'); $output = $xml->xpath('//soap:Body'); ?> I now have this: Array ( [0] => SimpleXMLElement Object ( [GetDocumentListResponse] => SimpleXMLElement Object ( [GetDocumentListResult] => <NewDataSet> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="_x0023_temp_list"> <xs:complexType> <xs:attribute name="tran_datetime" type="xs:string" /> <xs:attribute name="sender" type="xs:string" /> <xs:attribute name="doc_type_num" type="xs:string" /> <xs:attribute name="doc_date" type="xs:string" /> <xs:attribute name="doc_num" type="xs:string" /> <xs:attribute name="doc_sys_no" type="xs:string" /> <xs:attribute name="is_new" type="xs:string" /> </xs:complexType> </xs:element> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="_x0023_temp_list" /> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <_x0023_temp_list tran_datetime="2012-03-22T13:37:17.237" sender="webservice" doc_type_num="100" doc_date="2012-03-22T13:37:17.253" doc_num="12345" doc_sys_no="1234567" is_new="1" /> </NewDataSet> ) ) ) I am able to loop through this object and get to the part between the "NewDataSet" tags, but I can't seem to get to the individual elements. What I need is the attributes in the last tag that starts with _x0023_temp_list. I'm not sure if the tag is always going to be named that, so I will probably also have to deal with getting attributes from the tag with the xs namespace as well. I've read quite a few other posts and have tried several different methods of getting the info and so far nothing has seemed to work.

    Read the article

  • Whats the best way to design this database scenario?

    - by ankimal
    I want to setup 2 MySQL databases which differ in schema in that, one is normalized and the other is flat for quicker reads and writes. The information being stored in both DBs is the same, but the representation is obviously different owing to the different design approaches. I need to find a robust solution to sync information in real time from my normalized version to my flatter version.

    Read the article

  • How can I build a voting system to support multiple types of objects to vote on?

    - by Kyle Hayes
    I'm really looking for something very similar to the way SO is setup where a few different kinds of things can be voted on (questions AND answers). What kind of DB schema, generally, could I use to support voting on many different kinds of objects? Would I have a single Vote table that would have references to other objects in the database? Or do I have to have or should have a separate vote table for each of the objects I would like to vote on.

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >