www.91084.com

GVKun编程网logo

SQL Datawarehousing,是否需要使用TSQL SELECT或更好的替代方法来填充我的DIMENSION的帮助?

165

对于SQLDatawarehousing,是否需要使用TSQLSELECT或更好的替代方法来填充我的DIMENSION的帮助?感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于###Cause:j

对于SQL Datawarehousing,是否需要使用TSQL SELECT或更好的替代方法来填充我的DIMENSION的帮助?感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are、'UnexpectedTagNameException' and Element should have been “select” but was“div” error using 'Select' function through Selenium java、.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.、102.You want to import schema objects of the HR user using Oracle Data Pump from the development dat的有用信息。

本文目录一览:

SQL Datawarehousing,是否需要使用TSQL SELECT或更好的替代方法来填充我的DIMENSION的帮助?

SQL Datawarehousing,是否需要使用TSQL SELECT或更好的替代方法来填充我的DIMENSION的帮助?

我在SQL Server中有一个表,在这里“暂存”从ERP系统中提取的数据仓库。

通过此登台表( 表名称:DBO.DWUSD_LIVE ),我构建了维度并加载了事实数据。

DIMENSION表的示例称为“ SHIPTO”,此维具有以下列:

"shipto_id"shipto""salpha""ssalpha""shipto address""shipto name""shipto city"

现在,我有一个SSIS包,它对上述各列执行SELECT DISTINCT来检索“唯一”数据,然后通过SSIS包将“ shipto_id”代理键分配给它。

我当前的TSQL查询的一个示例是:

SELECT DISTINCT"shipto", "salpha", "ssalpha", "shipto address", "shipto name", "shipto city"FROM DBO.DWUSD_LIVE

这很好用,但不是“快速”的,某些尺寸有10列,对它们进行不同的选择并不理想。

在此维度中,我的“业务密钥” 列为“ SHIPTO”,“ SALPHA”和“ SSALPHA”

因此,如果我这样做:

SELECT DISTINCT"shipto", "salpha", "ssalpha"FROM DBO.DWUSD_LIVE

它产生与以下结果相同的结果:

SELECT DISTINCT"shipto", "salpha", "ssalpha", "shipto address", "shipto name", "shipto city"FROM DBO.DWUSD_LIVE

有没有更好的方法来执行此TSQL QUERY?我需要所有列,但只需要业务键列上的DISTINCT。

感谢您的帮助。

下图显示了如何在SSIS中设置我的项目,Dimensions是SCD 1。

答案1

我首先将其分为两个操作:生成代理键和填充维表。第一步将DISTINCT只有3列,而第二步将变为JOIN。索引这两个操作中使用的列可能会给您带来一些改进。

您可以将DISTINCT与结合使用,NOT EXISTS以避免处理已经被映射的行,如下所示:

insert into dbo.KeyMappingTable (shipto, salpha, ssalpha)select distinct shipto, salpha, ssalphafrom dbo.Sourcewhere not exists (    select *    from dbo.KeyMappingTable    where shipto = dbo.Source.shipto and salpha = dbo.Source.salpha and ssalpha = dbo.Source.ssalpha )

然后便有了映射,因此您可以执行以下操作:

insert into dbo.DimShipTo (shipto_id, shipto /*, etc. */)select    m.shipto_id,    s.shipto -- etc.from    dbo.KeyMappingTable m    join dbo.Source s    on m.shipto = s.shipto and m.salpha = s.salpha and m.ssalpha = s.ssalphawhere    not exists (        select *        from dbo.DimShipTo        where shipto_id = m.shipto_id    )

您还应该查看MERGE,如果您使用的是Type
1维度,并且只想在地址或其他属性更改时更新地址(这通常是一个有用的命令),这将很方便。但是它只能在SQL Server
2008中使用。您没有提到要使用的SQL Server版本。

### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are

### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are

Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

; SQL []; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
; SQL []; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
    at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:108)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
    at com.sun.proxy.$Proxy39.insert(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:253)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
    at com.sun.proxy.$Proxy52.saveV2(Unknown Source)

在进行修改数据库的时候出现了这个异常
很明显这个是只读引起的

可是事实上我们的数据账号权限很高,说明不是权限问题,说明是事务问题了
原因:你配置了只读事务
解决办法:

看下你的service层是否配置@Transactional(readOnly=true)
如果上面你没有配置的话,那就是spring切面引起的

在spring的配置文件中:

 <aop:config
  <aop:advisor pointcut-ref="servicePointcut" advice-ref="txAdvice"/>
    </aop:config>

    <!-- 事务的传播特性 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="get*" propagation="REQUIRED" read-only="true"/>
        <tx:method name="find*" propagation="REQUIRED" read-only="true"/>
        <tx:method name="query*" propagation="REQUIRED" read-only="true"/>
    </tx:attributes>

你是不是有类似于这样的,如果你的service方法名称是findpassword的话那么就会被拦截到了,然后就read-only了
所以改一下你的方法名称吧


或者在方法上添加注释
@Transactional(readOnly = false)

'UnexpectedTagNameException' and Element should have been “select” but was“div” error using 'Select' function through Selenium java

'UnexpectedTagNameException' and Element should have been “select” but was“div” error using 'Select' function through Selenium java

在这种形式的下拉列表中,选择不起作用。

我为此写代码

    public static void main(String[] args) throws InterruptedException     {    WebDriver driver =new ChromeDriver();    //driver.manage().window().maximize();    driver.get("http://www.ia.ca/");    Thread.sleep(3000);    driver.findElement(By.xpath("//*[@id=\"nav-secondaire\"]/div[1]/ul/li[4]/a")).click();    driver.findElement(By.xpath("//*[@id=\"nav-secondaire\"]/div[1]/ul/li[4]/ul/li[1]/section/ul/li[1]/a")).click();   //DropDown code    WebElement selectMyElement =driver.findElement(By.xpath("//*[@id=\"grille-zone-cta\"]/div/div/div/div/div/div[2]/div[1]"));    Select cal = new Select(selectMyElement);    cal.selectByIndex(1);

它给了我例外

‘UnexpectedTagNameException’

错误消息是

元素应为“选择”但为“ div”

答案1

小编典典

This error message…

''UnexpectedTagNameException'' : Element should have been "select" but was "div"

…暗示您已使用Select类与元素进行交互,其中元素为<div>

click()在文本上具有借入能力的元素上,可以使用以下定位策略:

  • xpath:
        new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//h4[@bta-description'' and text()=''Our calculators'']//following::div[@bta-select-table row'']//b[@button'']"))).click();        new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@selectric-items'']//li[contains(., ''Borrowing Capacity'')]"))).click();

.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.

.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2385)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2306)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
	at sun.reflect.GeneratedConstructorAccessor4.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
	at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:443)
	at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:141)
	at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:111)
	at cn.qjj.mysql.MySQLPool.getNewConnection(MySQLPool.java:72)
	at cn.qjj.mysql.MySQLPool.init(MySQLPool.java:63)
	at cn.qjj.mysql.MySQLPool.<init>(MySQLPool.java:32)
	at cn.qjj.mysql.MySQLPool.getInstance(MySQLPool.java:39)
	at cn.qjj.mysql.SqlUtils.<clinit>(SqlUtils.java:33)
	at cn.qjj.solr.MsgUtil.main(MsgUtil.java:31)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1112)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2483)
	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2324)
	... 18 more
java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
	at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
	at cn.qjj.mysql.MySQLPool.init(MySQLPool.java:63)
	at cn.qjj.mysql.MySQLPool.<init>(MySQLPool.java:32)
	at cn.qjj.mysql.MySQLPool.getInstance(MySQLPool.java:39)
	at cn.qjj.mysql.SqlUtils.<clinit>(SqlUtils.java:33)
	at cn.qjj.solr.MsgUtil.main(MsgUtil.java:31)



102.You want to import schema objects of the HR user using Oracle Data Pump from the development dat

102.You want to import schema objects of the HR user using Oracle Data Pump from the development dat

102.You want to import schema objects of the HR user using Oracle Data Pump from the development database,DEVDB,to the production database,PRODDB. A database link devdb.us.oracle.com is created between PRODDB and DEVDB. You execute the following command on the PRODDB database server: $ impdp system/manager directory = DB_DATA dumpfile = schemas.dat schemas = hr flashback_time = "TO_TIMESTAMP('25-08-2007 14:35:00','DD-MM-YYYY HH24:MI:SS')" The command fails displaying the following error: ORA-39001: invalid argument value ORA-39000: bad dump file specification ORA-31640: unable to open dump file "/home/oracle/schema/schemas.dat" for read ORA-27037: unable to obtain file status What would you do to overcome the error? A.Add the user,SYstem,to the schemas option. B.Add the network_link = devdb.us.oracle.com option. C.Change the dumpfile option to schema.dat@devdb.us.oracle.com. D.Replace the schemas option with the network_link = devdb.us.oracle.com option. E.Replace the dumpfile option with the network_link = devdb.us.oracle.com option. 答案:E 解析:这道题主要问的是远程导入,我们测试一下远程导入和导出 这里需要注意的是network_link和dumpfile不能同时出现,如果远程导入的话,并且数据文件不在被导入的服务器本地的话,那么 必须使用network_link,还有一种方法,那就是先导入本地,然后通过network_link导入目标数据库 impdp导入远程数据库 1.impdp system/oracle@test3 directory=data_pump_dir dumpfile=test.dmp logfile=log.log tables=test.dept; 这里directory指的是远程的目录,dumpfile指的是远程的文件 2.如果dmp文件在本地,那么只能通过使用network_link来进行操作 客户端A:wahaha3,存在test 服务端B:wahaha7,不存在test 在B上执行,impdp system/oracle directory=data_pump_dir logfile=log.log network_link='dblink3' schemas=test remap_tablespace=test:users; --这里需要注意,这个impdp是在目标端执行的,直接从远程客户机test导过来,说明还是在服务器上 在A上执行,impdp system/oracle@wahaha7 directory=data_pump_dir logfile=log.log network_link='dblink3' schemas=test remap_tablespace=test:users; 总结:这里impdp 连接的哪个库,就给哪个库里面导入,network_link是连接到的数据库的link expdp导出 在wahaha7上导出wahaha3的东西 1.wahaha7上创建public database link sql> CREATE PUBLIC DATABASE LINK dblink3 2 CONNECT TO system 3 IDENTIFIED BY oracle 4 using 'TEST3'; [oracle@wahaha7 ~]$ expdp system/oracle directory=data_pump_dir dumpfile=test.dmp logfile=log.log network_link='dblink3' schemas=test; directory==wahaha7的目录 dumpfile==wahaha7的文件 network_link==连接wahaha3的dblink --这个时候出成功,并且本地数据库中并没有导入test账号,这里使用system/oracle估计是使用dblink

今天关于SQL Datawarehousing,是否需要使用TSQL SELECT或更好的替代方法来填充我的DIMENSION的帮助?的分享就到这里,希望大家有所收获,若想了解更多关于### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are、'UnexpectedTagNameException' and Element should have been “select” but was“div” error using 'Select' function through Selenium java、.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.、102.You want to import schema objects of the HR user using Oracle Data Pump from the development dat等相关知识,可以在本站进行查询。

本文标签: