Unable to use import and use MySqlOperator in Apache airflow - airflow

I can't seem to be able to import Mysql.
like trying to import using this
from airflow.operators.mysql_operator import MySqlOperator
I get this error
"Cannot find reference 'MySqlOperator' in 'mysql_operator.py' "

Assuming you are on version 2.0.0 or greater, the import would be:
from airflow.providers.mysql.operators.mysql import MySqlOperator
Remember to install the MySQL providers package first:
pip install 'apache-airflow-providers-mysql'
Here is an example from the docs.

Related

Meteor Tabular errors on initialization

I'm following along the guide to setup Meteor Tabular v2.1.2 (guide). I have added the package and installed the theming packages. I'm using Meteor v2.8.0 and the project is a Blaze-based project.
In client/main.js, I set up the library as instructed.
import { $ } from 'meteor/jquery';
import dataTablesBootstrap from 'datatables.net-bs';
import 'datatables.net-bs/css/dataTables.bootstrap.css';
import "../imports/ui/body";
dataTablesBootstrap(window, $);
Now when I go to the browser, there is this error:
Can anyone help me on this?
So after serious debugging , I discovered it is enough to just import the DataTable module as such after installing it with npm
import { $ } from 'meteor/jquery';
import 'datatables.net-bs';
import 'datatables.net-bs/css/dataTables.bootstrap.css';
import "../imports/ui/body";
// You don't need the code previously here .
You can now setup you DataTable as such
$(element).DataTable(//Your config object)

Upgrading to Airflow 2, no module named 'airflow.hooks.base'

We're upgrading to Airflow 2 so I've changed the hooks import from:
from airflow.hooks.base_hook import BaseHook
to
from airflow.hooks.base import BaseHook
and now I'm getting this error:
{plugins_manager.py:225} ERROR - No module named 'airflow.hooks.base'
Here are the docs for this change, but I don't see any other required changes to get airflow.hooks.base to work: https://github.com/apache/airflow/blob/a17db7883044889b2b2001cefc41a8960359a23f/UPDATING.md#changes-to-import-paths
Make sure you are running on Airflow 2.0.
You can check which version you are running with the version command.
airflow version

Airflow 2 - ModuleNotFoundError: No module named 'airflow.operators.sensors'

After upgrading to Airflow 2, I got that error in some DAGs:
ModuleNotFoundError: No module named 'airflow.operators.sensors'
The new one that works:
from airflow.sensors.base import BaseSensorOperator
Chosen answer doesn't work for newer versions of Airflow.
I resolved by change the import.
old one
from airflow.operators.sensors import BaseSensorOperator
the new one that works
from airflow.sensors import BaseSensorOperator
BaseSensorOperator
I was trying to import ExternalTaskSensor and my research led me to this post, it turned out to be this class.
The correct import for me was
from airflow.sensors.external_task import ExternalTaskSensor
Just FYI in case anyone runs into this in the future.
For Airflow 2.1.1 I first installed Amazon provider:
pip install apache-airflow-providers-amazon
and then imported S3KeySensor:
from airflow.providers.amazon.aws.sensors.s3_key import S3KeySensor

The browser tells "failed to compile"

i import the bootstrap vue like this:
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
i already tried consulting all forums with similar questions but nothing
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
Failed to compile.
/home/fabry/node_modules/bootstrap-vue/dist/bootstrap-vue.css (./node_modules/css-loader??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??ref--6-oneOf-3-2!/home/fabry/node_modules/bootstrap-vue/dist/bootstrap-vue.css)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: No PostCSS Config found in: /home/fabry/node_modules/bootstrap-vue/dist
at config.search.then (/home/fabry/Scrivania/programmazione/web/Vue/realVueFool/quiz/node_modules/postcss-load-config/src/index.js:91:15)
Did you follow the instructions here?
It sounds like you either didn't install all the dependencies or failed to register components in your Vue app.

Qpython import modules in script

I have installed qpython for android, the problem is that when I install a module with pip in the python console I can import it properly, but not when I try to import it to a script.
in console ... I type:
>>>import requests
>>>requests
<module 'requests' from '/data/data/com.hipipal.qpyplus/.../__init__.py>
but in a script saved in scripts' folder, when I execute:
import requests
r = requests.get("http://www.google.com")
print r.text.encode('utf-8')
I get this:
import requests
ImportError: no module named requests
Can anybody help with that?
Thank you!
Add import site.
This works on my tablet:
#-*-coding:utf8;-*-
#qpy:2
#qpy:console
import site
import requests
r = requests.get("http://www.google.com")
print r.text.encode('utf-8')

Resources